Minor Matlab script corrections

This commit is contained in:
Thomas Dehaeze 2025-04-15 14:15:26 +02:00
parent d64c51e4b1
commit ae2385a49e
4 changed files with 15 additions and 17 deletions

View File

@ -405,6 +405,11 @@ for kp_i = 1:length(kps_pz)
opt_iff_kp_gain_pz(kp_i) = g_opt; opt_iff_kp_gain_pz(kp_i) = g_opt;
end 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 %% Define the obtained controllers
Kiff_kp_vc = Kiff_vc*opt_iff_kp_gain_vc(i_kp_vc); Kiff_kp_vc = Kiff_vc*opt_iff_kp_gain_vc(i_kp_vc);
Kiff_kp_vc.InputName = {'fu', 'fv'}; 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.InputName = {'fu', 'fv'};
Kiff_kp_pz.OutputName = {'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 %% Identify plants with choosen Parallel stiffnesses
model_config.Tuv_type = "parallel_k"; % Default: 2DoF stage model_config.Tuv_type = "parallel_k"; % Default: 2DoF stage

View File

@ -465,6 +465,4 @@ xticks([1e-1, 1e0, 1e1, 1e2, 1e3]);
xtickangle(0) xtickangle(0)
ldg = legend('location', 'northwest', 'FontSize', 8, 'NumColumns', 1); ldg = legend('location', 'northwest', 'FontSize', 8, 'NumColumns', 1);
ldg.ItemTokenSize = [20, 1]; ldg.ItemTokenSize = [20, 1];
linkaxes([ax1,ax2,ax3], 'y')
ylim([1e-8, 1e-2]) ylim([1e-8, 1e-2])

View File

@ -269,11 +269,11 @@ xlim([freqs(1), freqs(end)]);
%% Verify that parallel stiffness permits to have a stable plant %% Verify that parallel stiffness permits to have a stable plant
Kiff_pure_int = -200/s*eye(6); 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") disp("Decentralized IFF is not stable with rotation")
end 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") disp("Parallel stiffness makes the decentralized IFF stable")
else else
warning("Decentralized IFF is not stable even with the parallel stiffness") warning("Decentralized IFF is not stable even with the parallel stiffness")

View File

@ -230,10 +230,10 @@ tiledlayout(3, 1, 'TileSpacing', 'Compact', 'Padding', 'None');
ax1 = nexttile([2,1]); ax1 = nexttile([2,1]);
hold on; 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, abs(G_hac_m0_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, '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, abs(G_hac_m1_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, '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, abs(G_hac_m2_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, '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_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') xline(5, '--', 'linewidth', 1, 'color', [0,0,0,0.2], 'HandleVisibility', 'off')
hold off; hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
@ -244,10 +244,10 @@ leg.ItemTokenSize(1) = 15;
ax2 = nexttile; ax2 = nexttile;
hold on; 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, 180/pi*angle(G_hac_m0_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, '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, 180/pi*angle(G_hac_m1_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, '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, 180/pi*angle(G_hac_m2_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, '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_m3_Wz0(:,1, 1).*squeeze(freqresp(Khac(1,1), f, 'Hz'))), 'color', colors(4,:));
xline(5, '--', 'linewidth', 1, 'color', [0,0,0,0.2]) xline(5, '--', 'linewidth', 1, 'color', [0,0,0,0.2])
hold off; hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin'); set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');