Add script for showing all the possible displacement
This commit is contained in:
@@ -9,8 +9,24 @@ load('./mat/sim_conf.mat', 'sim_conf');
|
||||
|
||||
exp_without_nass.Dmeas.Data(:, 3) = exp_without_nass.Dmeas.Data(:, 3) - exp_without_nass.Dmeas.Data(end, 3);
|
||||
|
||||
Fs = ceil((length(exp_without_nass.Dmeas.Time(:))-1)/exp_without_nass.Dmeas.Time(end));
|
||||
|
||||
%%
|
||||
N = length(exp_without_nass.Dmeas.Data(:, 1));
|
||||
figure;
|
||||
hold on;
|
||||
% plot(exp_without_nass.Dmeas.Data(end-6300:end, 1),exp_without_nass.Dmeas.Data(end-6300:end, 2))
|
||||
plot(exp_without_nass.Dmeas.Data(N-6600:N-6200, 1),exp_without_nass.Dmeas.Data(N-6600:N-6200, 2))
|
||||
plot(exp_cl.Dmeas.Data(6:end, 1),exp_cl.Dmeas.Data(6:end, 2))
|
||||
xlim([-1e-6, 1e-6]);
|
||||
ylim([-1e-6, 1e-6]);
|
||||
hold off;
|
||||
xlabel('Displacement - $x$ [m]'); ylabel('Displacement - $y$ [m]');
|
||||
|
||||
|
||||
%% With and without NASS
|
||||
steady_i = ceil(length(exp_ol.Dmeas.Time)/2);
|
||||
steady_i = 6;
|
||||
|
||||
figure;
|
||||
hold on;
|
||||
@@ -23,6 +39,99 @@ xlabel('Displacement - $x$ [m]'); ylabel('Displacement - $y$ [m]');
|
||||
|
||||
exportFig('exp_w_wo_nass_xy', 'half-short')
|
||||
|
||||
%% Video of the simulation
|
||||
close all;
|
||||
|
||||
figure(1);
|
||||
hold on;
|
||||
grid;
|
||||
xlim([-1e-6, 1e-6]);
|
||||
ylim([-1e-6, 1e-6]);
|
||||
xlabel('Displacement - $x$ [m]'); ylabel('Displacement - $y$ [m]');
|
||||
|
||||
% Set up the movie.
|
||||
writerObj = VideoWriter('open_loop.avi'); % Name it.
|
||||
writerObj.FrameRate = 30; % How many frames per second.
|
||||
open(writerObj);
|
||||
|
||||
% Open Loop
|
||||
N = length(exp_without_nass.Dmeas.Data(:, 1))-6300;
|
||||
step_i = ceil(Fs/writerObj.FrameRate);
|
||||
for i=1:step_i:N
|
||||
% We just use pause but pretend you have some really complicated thing here...
|
||||
pause(0.01);
|
||||
figure(1);
|
||||
plot(exp_without_nass.Dmeas.Data(i:min(i+step_i, N), 1),exp_without_nass.Dmeas.Data(i:min(i+step_i, N), 2), 'color', [0 0.4470 0.7410])
|
||||
frame = getframe(gcf); % 'gcf' can handle if you zoom in to take a movie.
|
||||
writeVideo(writerObj, frame);
|
||||
end
|
||||
|
||||
% Close Loop
|
||||
N = length(exp_cl.Dmeas.Data(:, 1));
|
||||
step_i = ceil(Fs/writerObj.FrameRate);
|
||||
first_i = 6;
|
||||
for i=first_i:step_i:N
|
||||
% We just use pause but pretend you have some really complicated thing here...
|
||||
pause(0.01);
|
||||
figure(1);
|
||||
plot(exp_cl.Dmeas.Data(i:min(i+step_i, N), 1),exp_cl.Dmeas.Data(i:min(i+step_i, N), 2), 'color', [0.8500 0.3250 0.0980])
|
||||
frame = getframe(gcf); % 'gcf' can handle if you zoom in to take a movie.
|
||||
writeVideo(writerObj, frame);
|
||||
end
|
||||
|
||||
hold off
|
||||
close(writerObj); % Saves the movie.
|
||||
|
||||
|
||||
%% Video of the simulation
|
||||
close all;
|
||||
|
||||
figure(1);
|
||||
hold on;
|
||||
xlim([-40, 40]);
|
||||
ylim([-40, 40]);
|
||||
yticks([-40 -20 0 20 40])
|
||||
xticks([-40 -20 0 20 40])
|
||||
grid on;
|
||||
xlabel('Displacement - $x$ [nm]'); ylabel('Displacement - $y$ [nm]');
|
||||
|
||||
set(gcf, 'pos', [20 20 300 300]);
|
||||
|
||||
% Set up the movie.
|
||||
writerObj = VideoWriter('close_loop_zoom.avi'); % Name it.
|
||||
writerObj.FrameRate = 30; % How many frames per second.
|
||||
open(writerObj);
|
||||
|
||||
% Open Loop
|
||||
N = length(exp_without_nass.Dmeas.Data(:, 1))-6300;
|
||||
step_i = ceil(Fs/writerObj.FrameRate);
|
||||
for i=1:step_i:N
|
||||
% We just use pause but pretend you have some really complicated thing here...
|
||||
pause(0.01);
|
||||
figure(1);
|
||||
plot(1e9*exp_without_nass.Dmeas.Data(i:min(i+step_i, N), 1),1e9*exp_without_nass.Dmeas.Data(i:min(i+step_i, N), 2), 'color', [0 0.4470 0.7410])
|
||||
frame = getframe(gcf); % 'gcf' can handle if you zoom in to take a movie.
|
||||
writeVideo(writerObj, frame);
|
||||
end
|
||||
|
||||
% Close Loop
|
||||
N = length(exp_cl.Dmeas.Data(:, 1));
|
||||
step_i = ceil(Fs/writerObj.FrameRate);
|
||||
first_i = 6;
|
||||
for i=first_i:step_i:N
|
||||
% We just use pause but pretend you have some really complicated thing here...
|
||||
pause(0.01);
|
||||
figure(1);
|
||||
plot(1e9*exp_cl.Dmeas.Data(i:min(i+step_i, N), 1),1e9*exp_cl.Dmeas.Data(i:min(i+step_i, N), 2), 'color', [0.8500 0.3250 0.0980])
|
||||
frame = getframe(gcf); % 'gcf' can handle if you zoom in to take a movie.
|
||||
writeVideo(writerObj, frame);
|
||||
end
|
||||
|
||||
hold off
|
||||
close(writerObj); % Saves the movie.
|
||||
|
||||
|
||||
%%
|
||||
figure;
|
||||
hold on;
|
||||
plot(exp_without_nass.Dmeas.Time(steady_i:end), exp_without_nass.Dmeas.Data(steady_i:end, 2));
|
||||
|
Reference in New Issue
Block a user