From ae2385a49e0764e1218ccb0fe5783f85846244db Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Tue, 15 Apr 2025 14:15:26 +0200 Subject: [PATCH] Minor Matlab script corrections --- .../rotating_7_nano_hexapod.m | 10 +++++----- A2-nass-rotating-3dof-model/rotating_8_nass.m | 2 -- A6-simscape-nass/nass_1_active_damping.m | 4 ++-- C5-test-bench-id31/test_id31_4_hac.m | 16 ++++++++-------- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/A2-nass-rotating-3dof-model/rotating_7_nano_hexapod.m b/A2-nass-rotating-3dof-model/rotating_7_nano_hexapod.m index e9406cc..2abbef5 100644 --- a/A2-nass-rotating-3dof-model/rotating_7_nano_hexapod.m +++ b/A2-nass-rotating-3dof-model/rotating_7_nano_hexapod.m @@ -405,6 +405,11 @@ for kp_i = 1:length(kps_pz) opt_iff_kp_gain_pz(kp_i) = g_opt; end +%% Find result with wanted parallel stiffness +[~, i_kp_vc] = min(abs(kps_vc - 1e3)); +[~, i_kp_md] = min(abs(kps_md - 1e4)); +[~, i_kp_pz] = min(abs(kps_pz - 1e6)); + %% Define the obtained controllers Kiff_kp_vc = Kiff_vc*opt_iff_kp_gain_vc(i_kp_vc); Kiff_kp_vc.InputName = {'fu', 'fv'}; @@ -418,11 +423,6 @@ Kiff_kp_pz = Kiff_pz*opt_iff_kp_gain_pz(i_kp_pz); Kiff_kp_pz.InputName = {'fu', 'fv'}; Kiff_kp_pz.OutputName = {'Fu', 'Fv'}; -%% Find result with wanted parallel stiffness -[~, i_kp_vc] = min(abs(kps_vc - 1e3)); -[~, i_kp_md] = min(abs(kps_md - 1e4)); -[~, i_kp_pz] = min(abs(kps_pz - 1e6)); - %% Identify plants with choosen Parallel stiffnesses model_config.Tuv_type = "parallel_k"; % Default: 2DoF stage diff --git a/A2-nass-rotating-3dof-model/rotating_8_nass.m b/A2-nass-rotating-3dof-model/rotating_8_nass.m index 6306e2b..245e1ef 100644 --- a/A2-nass-rotating-3dof-model/rotating_8_nass.m +++ b/A2-nass-rotating-3dof-model/rotating_8_nass.m @@ -465,6 +465,4 @@ xticks([1e-1, 1e0, 1e1, 1e2, 1e3]); xtickangle(0) ldg = legend('location', 'northwest', 'FontSize', 8, 'NumColumns', 1); ldg.ItemTokenSize = [20, 1]; - -linkaxes([ax1,ax2,ax3], 'y') ylim([1e-8, 1e-2]) diff --git a/A6-simscape-nass/nass_1_active_damping.m b/A6-simscape-nass/nass_1_active_damping.m index 47dd50c..778502d 100644 --- a/A6-simscape-nass/nass_1_active_damping.m +++ b/A6-simscape-nass/nass_1_active_damping.m @@ -269,11 +269,11 @@ xlim([freqs(1), freqs(end)]); %% Verify that parallel stiffness permits to have a stable plant Kiff_pure_int = -200/s*eye(6); -if not(isstable(feedback(G_iff_m25_Rz, Kiff_pure_int, 1))) +if isstable(feedback(G_iff_m25_Rz_no_kp, Kiff_pure_int, 1)) disp("Decentralized IFF is not stable with rotation") end -if isstable(feedback(G_iff_m25_Rz_no_kp, Kiff_pure_int, 1)) +if not(isstable(feedback(G_iff_m25_Rz, Kiff_pure_int, 1))) disp("Parallel stiffness makes the decentralized IFF stable") else warning("Decentralized IFF is not stable even with the parallel stiffness") diff --git a/C5-test-bench-id31/test_id31_4_hac.m b/C5-test-bench-id31/test_id31_4_hac.m index a4f77fd..f9929d0 100644 --- a/C5-test-bench-id31/test_id31_4_hac.m +++ b/C5-test-bench-id31/test_id31_4_hac.m @@ -230,10 +230,10 @@ tiledlayout(3, 1, 'TileSpacing', 'Compact', 'Padding', 'None'); ax1 = nexttile([2,1]); hold on; -plot(f(2:end), abs(G_hac_m0_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f(2:end), 'Hz'))), 'color', colors(1,:), 'DisplayName', '$0$ kg'); -plot(f(2:end), abs(G_hac_m1_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f(2:end), 'Hz'))), 'color', colors(2,:), 'DisplayName', '$13$ kg'); -plot(f(2:end), abs(G_hac_m2_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f(2:end), 'Hz'))), 'color', colors(3,:), 'DisplayName', '$26$ kg'); -plot(f(2:end), abs(G_hac_m3_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f(2:end), 'Hz'))), 'color', colors(4,:), 'DisplayName', '$39$ kg'); +plot(f, abs(G_hac_m0_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, 'Hz'))), 'color', colors(1,:), 'DisplayName', '$0$ kg'); +plot(f, abs(G_hac_m1_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, 'Hz'))), 'color', colors(2,:), 'DisplayName', '$13$ kg'); +plot(f, abs(G_hac_m2_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, 'Hz'))), 'color', colors(3,:), 'DisplayName', '$26$ kg'); +plot(f, abs(G_hac_m3_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, 'Hz'))), 'color', colors(4,:), 'DisplayName', '$39$ kg'); xline(5, '--', 'linewidth', 1, 'color', [0,0,0,0.2], 'HandleVisibility', 'off') hold off; set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); @@ -244,10 +244,10 @@ leg.ItemTokenSize(1) = 15; ax2 = nexttile; hold on; -plot(f(2:end), 180/pi*angle(G_hac_m0_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f(2:end), 'Hz'))), 'color', colors(1,:)); -plot(f(2:end), 180/pi*angle(G_hac_m1_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f(2:end), 'Hz'))), 'color', colors(2,:)); -plot(f(2:end), 180/pi*angle(G_hac_m2_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f(2:end), 'Hz'))), 'color', colors(3,:)); -plot(f(2:end), 180/pi*angle(G_hac_m3_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f(2:end), 'Hz'))), 'color', colors(4,:)); +plot(f, 180/pi*angle(G_hac_m0_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, 'Hz'))), 'color', colors(1,:)); +plot(f, 180/pi*angle(G_hac_m1_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, 'Hz'))), 'color', colors(2,:)); +plot(f, 180/pi*angle(G_hac_m2_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, 'Hz'))), 'color', colors(3,:)); +plot(f, 180/pi*angle(G_hac_m3_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, 'Hz'))), 'color', colors(4,:)); xline(5, '--', 'linewidth', 1, 'color', [0,0,0,0.2]) hold off; set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');