Correct Matlab scripts

This commit is contained in:
Thomas Dehaeze 2025-04-15 09:29:40 +02:00
parent 122273e102
commit b4c654a0e2
7 changed files with 98 additions and 72 deletions

View File

@ -65,11 +65,12 @@ load('meas_spindle_on.mat', 't', 'vg', 'vh');
spindle_off = load('meas_spindle_off.mat', 't', 'vg', 'vh'); % No Rotation
% Compute Power Spectral Density of the relative velocity between granite and hexapod during spindle rotation
Fs = 1/(t(2)-t(1)); % Sampling Frequency [Hz]
win = hanning(ceil(2*Fs)); % Hanning window
Ts = t(2)-t(1); % Sampling Time [s]
Nfft = floor(2/Ts);
win = hanning(Nfft);
[psd_vft, f] = pwelch(vh-vg, win, [], [], Fs); % [(m/s)^2/Hz]
[psd_off, ~] = pwelch(spindle_off.vh-spindle_off.vg, win, [], [], Fs); % [(m/s)^2/Hz]
[psd_vft, f] = pwelch(vh-vg, win, Noverlap, Nfft, 1/Ts); % [(m/s)^2/Hz]
[psd_off, ~] = pwelch(spindle_off.vh-spindle_off.vg, win, Noverlap, Nfft, 1/Ts); % [(m/s)^2/Hz]
% Disable the Nano-Hexpod for now
model_config = struct();

View File

@ -56,7 +56,7 @@ set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Amplitude $d/x_{f}$ [m/m]'); xlabel('Frequency [Hz]');
xticks([1e0, 1e1, 1e2]);
leg = legend('location', 'southeast', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
xlim([1, 500]);
%% Cumulative Amplitude Spectrum of the relative motion d, due to both the floor motion and the stage vibrations
@ -72,7 +72,7 @@ hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('CAS [m]'); xlabel('Frequency [Hz]');
leg = legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 2);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
xlim([1, 500]);
ylim([1e-12, 3e-6])
@ -104,7 +104,7 @@ hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('CAS [m]'); xlabel('Frequency [Hz]');
leg = legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
xlim([1, 500]);
ylim([1e-12, 3e-6])

View File

@ -221,19 +221,25 @@ G_dvf_pz_heavy = feedback(G_pz_heavy, K_dvf_pz, 'name', +1);
%% Verify Stability
% IFF
isstable(G_iff_vc_light) && isstable(G_iff_vc_mid) && isstable(G_iff_vc_heavy) && ...
if not(isstable(G_iff_vc_light) && isstable(G_iff_vc_mid) && isstable(G_iff_vc_heavy) && ...
isstable(G_iff_md_light) && isstable(G_iff_md_mid) && isstable(G_iff_md_heavy) && ...
isstable(G_iff_pz_light) && isstable(G_iff_pz_mid) && isstable(G_iff_pz_heavy)
isstable(G_iff_pz_light) && isstable(G_iff_pz_mid) && isstable(G_iff_pz_heavy))
warning("One of the damped plant with decentralized IFF is not stable.");
end
% RDC
isstable(G_rdc_vc_light) && isstable(G_rdc_vc_mid) && isstable(G_rdc_vc_heavy) && ...
if not(isstable(G_rdc_vc_light) && isstable(G_rdc_vc_mid) && isstable(G_rdc_vc_heavy) && ...
isstable(G_rdc_md_light) && isstable(G_rdc_md_mid) && isstable(G_rdc_md_heavy) && ...
isstable(G_rdc_pz_light) && isstable(G_rdc_pz_mid) && isstable(G_rdc_pz_heavy)
isstable(G_rdc_pz_light) && isstable(G_rdc_pz_mid) && isstable(G_rdc_pz_heavy))
warning("One of the damped plant with decentralized RDC is not stable.");
end
% DVF
isstable(G_dvf_vc_light) && isstable(G_dvf_vc_mid) && isstable(G_dvf_vc_heavy) && ...
if not(isstable(G_dvf_vc_light) && isstable(G_dvf_vc_mid) && isstable(G_dvf_vc_heavy) && ...
isstable(G_dvf_md_light) && isstable(G_dvf_md_mid) && isstable(G_dvf_md_heavy) && ...
isstable(G_dvf_pz_light) && isstable(G_dvf_pz_mid) && isstable(G_dvf_pz_heavy)
isstable(G_dvf_pz_light) && isstable(G_dvf_pz_mid) && isstable(G_dvf_pz_heavy))
warning("One of the damped plant with decentralized DVF is not stable.");
end
%% Save Damped Plants
save('./mat/uniaxial_damped_plants.mat', 'G_iff_vc_light', 'G_iff_md_light', 'G_iff_pz_light', ...

View File

@ -258,7 +258,7 @@ hold off;
set(gca, 'XScale', 'lin'); set(gca, 'YScale', 'lin');
xlabel('Real'); ylabel('Imag');
leg = legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
xlim([-3.8, 0.2]); ylim([-2, 2]);
axis square;
@ -279,7 +279,7 @@ hold off;
set(gca, 'XScale', 'lin'); set(gca, 'YScale', 'lin');
xlabel('Real'); ylabel('Imag');
leg = legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
xlim([-3.8, 0.2]); ylim([-2, 2]);
axis square;
@ -300,7 +300,7 @@ hold off;
set(gca, 'XScale', 'lin'); set(gca, 'YScale', 'lin');
xlabel('Real'); ylabel('Imag');
leg = legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
xlim([-3.8, 0.2]); ylim([-2, 2]);
axis square;
@ -319,7 +319,7 @@ ylabel('Loop Gain'); set(gca, 'XTickLabel',[]);
ylim([1e-3, 1e3]);
yticks([1e-2, 1, 1e2])
leg = legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
ax2 = nexttile;
hold on;
@ -413,11 +413,17 @@ G_hac_iff_pz_mid = feedback(G_iff_pz_mid , K_hac_pz, 'name', -1);
G_hac_iff_pz_heavy = feedback(G_iff_pz_heavy, K_hac_pz, 'name', -1);
%% Verify Stability
isstable(G_hac_iff_vc_light) && isstable(G_hac_iff_vc_mid) && isstable(G_hac_iff_vc_heavy)
if not(isstable(G_hac_iff_vc_light) && isstable(G_hac_iff_vc_mid) && isstable(G_hac_iff_vc_heavy))
warning("One of the damped plant with VC and decentralized IFF is not stable.");
end
isstable(G_hac_iff_md_light) && isstable(G_hac_iff_md_mid) && isstable(G_hac_iff_md_heavy)
if not(isstable(G_hac_iff_md_light) && isstable(G_hac_iff_md_mid) && isstable(G_hac_iff_md_heavy))
warning("One of the damped plant with MD and decentralized IFF is not stable.");
end
isstable(G_hac_iff_pz_light) && isstable(G_hac_iff_pz_mid) && isstable(G_hac_iff_pz_heavy)
if not(isstable(G_hac_iff_pz_light) && isstable(G_hac_iff_pz_mid) && isstable(G_hac_iff_pz_heavy))
warning("One of the damped plant with PZ and decentralized IFF is not stable.");
end
%% Change of sensitivity to disturbances with LAC and with HAC-LAC
figure;

View File

@ -324,18 +324,18 @@ G_iff_vc_light_rigid = feedback(G_vc_light_rigid, K_iff_vc, 'name', +1);
G_iff_vc_light_soft = feedback(G_vc_light_soft , K_iff_vc, 'name', +1);
G_iff_vc_light_stiff = feedback(G_vc_light_stiff, K_iff_vc, 'name', +1);
isstable(G_iff_vc_light_rigid)
isstable(G_iff_vc_light_soft)
isstable(G_iff_vc_light_stiff)
if not(isstable(G_iff_vc_light_rigid) && isstable(G_iff_vc_light_soft) &&isstable(G_iff_vc_light_stiff))
warning("One of the damped plant with VC and decentralized IFF is not stable.");
end
% Stiff Nano-Hexapod
G_iff_pz_light_rigid = feedback(G_pz_light_rigid, K_iff_pz, 'name', +1);
G_iff_pz_light_soft = feedback(G_pz_light_soft , K_iff_pz, 'name', +1);
G_iff_pz_light_stiff = feedback(G_pz_light_stiff, K_iff_pz, 'name', +1);
isstable(G_iff_pz_light_rigid)
isstable(G_iff_pz_light_soft)
isstable(G_iff_pz_light_stiff)
if not(isstable(G_iff_pz_light_rigid) && isstable(G_iff_pz_light_soft) && isstable(G_iff_pz_light_stiff))
warning("One of the damped plant with PZ and decentralized IFF is not stable.");
end
%% Compute closed-loop plants and verify stability
% Soft Nano-Hexapod
@ -343,18 +343,18 @@ G_hac_iff_vc_light_rigid = feedback(G_iff_vc_light_rigid, K_hac_vc, 'name', -1);
G_hac_iff_vc_light_soft = feedback(G_iff_vc_light_soft , K_hac_vc, 'name', -1);
G_hac_iff_vc_light_stiff = feedback(G_iff_vc_light_stiff, K_hac_vc, 'name', -1);
isstable(G_hac_iff_vc_light_rigid)
isstable(G_hac_iff_vc_light_soft)
isstable(G_hac_iff_vc_light_stiff)
if not(isstable(G_hac_iff_vc_light_rigid) && isstable(G_hac_iff_vc_light_soft) && isstable(G_hac_iff_vc_light_stiff))
warning("One of the damped plant with VC and decentralized IFF is not stable.");
end
% Stiff Nano-Hexapod
G_hac_iff_pz_light_rigid = feedback(G_iff_pz_light_rigid, K_hac_pz, 'name', -1);
G_hac_iff_pz_light_soft = feedback(G_iff_pz_light_soft , K_hac_pz, 'name', -1);
G_hac_iff_pz_light_stiff = feedback(G_iff_pz_light_stiff, K_hac_pz, 'name', -1);
isstable(G_hac_iff_pz_light_rigid)
isstable(G_hac_iff_pz_light_soft)
isstable(G_hac_iff_pz_light_stiff)
if not(isstable(G_hac_iff_pz_light_rigid) && isstable(G_hac_iff_pz_light_soft) && isstable(G_hac_iff_pz_light_stiff))
warning("One of the damped plant with PZ and decentralized IFF is not stable.");
end
%% Cumulative Amplitude Spectrum of d - Effect of Sample's flexibility
figure;

View File

@ -1500,11 +1500,12 @@ load('meas_spindle_on.mat', 't', 'vg', 'vh');
spindle_off = load('meas_spindle_off.mat', 't', 'vg', 'vh'); % No Rotation
% Compute Power Spectral Density of the relative velocity between granite and hexapod during spindle rotation
Fs = 1/(t(2)-t(1)); % Sampling Frequency [Hz]
win = hanning(ceil(2*Fs)); % Hanning window
Ts = t(2)-t(1); % Sampling Time [s]
Nfft = floor(2/Ts);
win = hanning(Nfft);
[psd_vft, f] = pwelch(vh-vg, win, [], [], Fs); % [(m/s)^2/Hz]
[psd_off, ~] = pwelch(spindle_off.vh-spindle_off.vg, win, [], [], Fs); % [(m/s)^2/Hz]
[psd_vft, f] = pwelch(vh-vg, win, Noverlap, Nfft, 1/Ts); % [(m/s)^2/Hz]
[psd_off, ~] = pwelch(spindle_off.vh-spindle_off.vg, win, Noverlap, Nfft, 1/Ts); % [(m/s)^2/Hz]
% Disable the Nano-Hexpod for now
model_config = struct();
@ -1696,7 +1697,7 @@ set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Amplitude $d/x_{f}$ [m/m]'); xlabel('Frequency [Hz]');
xticks([1e0, 1e1, 1e2]);
leg = legend('location', 'southeast', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
xlim([1, 500]);
#+end_src
@ -1751,7 +1752,7 @@ hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('CAS [m]'); xlabel('Frequency [Hz]');
leg = legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 2);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
xlim([1, 500]);
ylim([1e-12, 3e-6])
@ -1789,7 +1790,7 @@ hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('CAS [m]'); xlabel('Frequency [Hz]');
leg = legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
xlim([1, 500]);
ylim([1e-12, 3e-6])
@ -2960,19 +2961,25 @@ G_dvf_pz_heavy = feedback(G_pz_heavy, K_dvf_pz, 'name', +1);
#+begin_src matlab
%% Verify Stability
% IFF
isstable(G_iff_vc_light) && isstable(G_iff_vc_mid) && isstable(G_iff_vc_heavy) && ...
if not(isstable(G_iff_vc_light) && isstable(G_iff_vc_mid) && isstable(G_iff_vc_heavy) && ...
isstable(G_iff_md_light) && isstable(G_iff_md_mid) && isstable(G_iff_md_heavy) && ...
isstable(G_iff_pz_light) && isstable(G_iff_pz_mid) && isstable(G_iff_pz_heavy)
isstable(G_iff_pz_light) && isstable(G_iff_pz_mid) && isstable(G_iff_pz_heavy))
warning("One of the damped plant with decentralized IFF is not stable.");
end
% RDC
isstable(G_rdc_vc_light) && isstable(G_rdc_vc_mid) && isstable(G_rdc_vc_heavy) && ...
if not(isstable(G_rdc_vc_light) && isstable(G_rdc_vc_mid) && isstable(G_rdc_vc_heavy) && ...
isstable(G_rdc_md_light) && isstable(G_rdc_md_mid) && isstable(G_rdc_md_heavy) && ...
isstable(G_rdc_pz_light) && isstable(G_rdc_pz_mid) && isstable(G_rdc_pz_heavy)
isstable(G_rdc_pz_light) && isstable(G_rdc_pz_mid) && isstable(G_rdc_pz_heavy))
warning("One of the damped plant with decentralized RDC is not stable.");
end
% DVF
isstable(G_dvf_vc_light) && isstable(G_dvf_vc_mid) && isstable(G_dvf_vc_heavy) && ...
if not(isstable(G_dvf_vc_light) && isstable(G_dvf_vc_mid) && isstable(G_dvf_vc_heavy) && ...
isstable(G_dvf_md_light) && isstable(G_dvf_md_mid) && isstable(G_dvf_md_heavy) && ...
isstable(G_dvf_pz_light) && isstable(G_dvf_pz_mid) && isstable(G_dvf_pz_heavy)
isstable(G_dvf_pz_light) && isstable(G_dvf_pz_mid) && isstable(G_dvf_pz_heavy))
warning("One of the damped plant with decentralized DVF is not stable.");
end
#+end_src
#+begin_src matlab :exports none :tangle no
@ -4253,7 +4260,7 @@ hold off;
set(gca, 'XScale', 'lin'); set(gca, 'YScale', 'lin');
xlabel('Real'); ylabel('Imag');
leg = legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
xlim([-3.8, 0.2]); ylim([-2, 2]);
axis square;
#+end_src
@ -4280,7 +4287,7 @@ hold off;
set(gca, 'XScale', 'lin'); set(gca, 'YScale', 'lin');
xlabel('Real'); ylabel('Imag');
leg = legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
xlim([-3.8, 0.2]); ylim([-2, 2]);
axis square;
#+end_src
@ -4307,7 +4314,7 @@ hold off;
set(gca, 'XScale', 'lin'); set(gca, 'YScale', 'lin');
xlabel('Real'); ylabel('Imag');
leg = legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
xlim([-3.8, 0.2]); ylim([-2, 2]);
axis square;
#+end_src
@ -4356,7 +4363,7 @@ ylabel('Loop Gain'); set(gca, 'XTickLabel',[]);
ylim([1e-3, 1e3]);
yticks([1e-2, 1, 1e2])
leg = legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15
leg.ItemTokenSize(1) = 15;
ax2 = nexttile;
hold on;
@ -4501,11 +4508,17 @@ G_hac_iff_pz_heavy = feedback(G_iff_pz_heavy, K_hac_pz, 'name', -1);
#+begin_src matlab :exports none
%% Verify Stability
isstable(G_hac_iff_vc_light) && isstable(G_hac_iff_vc_mid) && isstable(G_hac_iff_vc_heavy)
if not(isstable(G_hac_iff_vc_light) && isstable(G_hac_iff_vc_mid) && isstable(G_hac_iff_vc_heavy))
warning("One of the damped plant with VC and decentralized IFF is not stable.");
end
isstable(G_hac_iff_md_light) && isstable(G_hac_iff_md_mid) && isstable(G_hac_iff_md_heavy)
if not(isstable(G_hac_iff_md_light) && isstable(G_hac_iff_md_mid) && isstable(G_hac_iff_md_heavy))
warning("One of the damped plant with MD and decentralized IFF is not stable.");
end
isstable(G_hac_iff_pz_light) && isstable(G_hac_iff_pz_mid) && isstable(G_hac_iff_pz_heavy)
if not(isstable(G_hac_iff_pz_light) && isstable(G_hac_iff_pz_mid) && isstable(G_hac_iff_pz_heavy))
warning("One of the damped plant with PZ and decentralized IFF is not stable.");
end
#+end_src
#+begin_src matlab :exports none :results none
@ -6008,18 +6021,18 @@ G_iff_vc_light_rigid = feedback(G_vc_light_rigid, K_iff_vc, 'name', +1);
G_iff_vc_light_soft = feedback(G_vc_light_soft , K_iff_vc, 'name', +1);
G_iff_vc_light_stiff = feedback(G_vc_light_stiff, K_iff_vc, 'name', +1);
isstable(G_iff_vc_light_rigid)
isstable(G_iff_vc_light_soft)
isstable(G_iff_vc_light_stiff)
if not(isstable(G_iff_vc_light_rigid) && isstable(G_iff_vc_light_soft) &&isstable(G_iff_vc_light_stiff))
warning("One of the damped plant with VC and decentralized IFF is not stable.");
end
% Stiff Nano-Hexapod
G_iff_pz_light_rigid = feedback(G_pz_light_rigid, K_iff_pz, 'name', +1);
G_iff_pz_light_soft = feedback(G_pz_light_soft , K_iff_pz, 'name', +1);
G_iff_pz_light_stiff = feedback(G_pz_light_stiff, K_iff_pz, 'name', +1);
isstable(G_iff_pz_light_rigid)
isstable(G_iff_pz_light_soft)
isstable(G_iff_pz_light_stiff)
if not(isstable(G_iff_pz_light_rigid) && isstable(G_iff_pz_light_soft) && isstable(G_iff_pz_light_stiff))
warning("One of the damped plant with PZ and decentralized IFF is not stable.");
end
#+end_src
#+begin_src matlab
@ -6029,18 +6042,18 @@ G_hac_iff_vc_light_rigid = feedback(G_iff_vc_light_rigid, K_hac_vc, 'name', -1);
G_hac_iff_vc_light_soft = feedback(G_iff_vc_light_soft , K_hac_vc, 'name', -1);
G_hac_iff_vc_light_stiff = feedback(G_iff_vc_light_stiff, K_hac_vc, 'name', -1);
isstable(G_hac_iff_vc_light_rigid)
isstable(G_hac_iff_vc_light_soft)
isstable(G_hac_iff_vc_light_stiff)
if not(isstable(G_hac_iff_vc_light_rigid) && isstable(G_hac_iff_vc_light_soft) && isstable(G_hac_iff_vc_light_stiff))
warning("One of the damped plant with VC and decentralized IFF is not stable.");
end
% Stiff Nano-Hexapod
G_hac_iff_pz_light_rigid = feedback(G_iff_pz_light_rigid, K_hac_pz, 'name', -1);
G_hac_iff_pz_light_soft = feedback(G_iff_pz_light_soft , K_hac_pz, 'name', -1);
G_hac_iff_pz_light_stiff = feedback(G_iff_pz_light_stiff, K_hac_pz, 'name', -1);
isstable(G_hac_iff_pz_light_rigid)
isstable(G_hac_iff_pz_light_soft)
isstable(G_hac_iff_pz_light_stiff)
if not(isstable(G_hac_iff_pz_light_rigid) && isstable(G_hac_iff_pz_light_soft) && isstable(G_hac_iff_pz_light_stiff))
warning("One of the damped plant with PZ and decentralized IFF is not stable.");
end
#+end_src
#+begin_src matlab :exports none :results none