plots: plot more differences

master
EmaMaker 2024-09-06 15:49:49 +02:00
parent cbd177342d
commit f4067fe7d2
2 changed files with 36 additions and 9 deletions

View File

@ -35,6 +35,8 @@ for i = 1:s_(1)
dir = ['images-diffdrive/', sPLOT_TEST, '/']
mkdir(dir);
%{
for n=1:3
clf; plot_trajectory(t{n}, ref_t{n}, q{n})
export_fig(gcf, '-transparent', [dir, num2str(n), '_trajectory.eps'])
@ -61,11 +63,24 @@ for i = 1:s_(1)
%export_fig(gcf, '-transparent', [dir, num2str(n), '_total_input.eps'])
%print([dir, num2str(n), '_total_input.png'], '-dpng')
end
%}
% correction difference (multistep, 1-step)
clf; plot_input_diff(t{3}, t{2}, U_corr{3}, U_corr{2}, 0, '\textbf{$$\omega_r^{corr, multistep}$$}', '\textbf{$$\omega_r^{corr, 1step}$$}', '\textbf{$$\omega_l^{corr, multistep}$$}', '\textbf{$$\omega_l^{corr, 1step}$$}')
export_fig(gcf, '-transparent', [dir, 'corr_input_diff_1x2.eps'])
clf; plot_input_diff(t{3}, t{2}, U_corr{3}, U_corr{2}, 1, '\textbf{$$\omega_r^{corr, multistep}$$}', '\textbf{$$\omega_r^{corr, 1step}$$}', '\textbf{$$\omega_l^{corr, multistep}$$}', '\textbf{$$\omega_l^{corr, 1step}$$}')
export_fig(gcf, '-transparent', [dir, 'corr_input_diff_2x1.eps'])
% input difference (saturated track only, 1step)
clf; plot_input_diff(t{1}, t{2}, U{1}, U{2}, 0, '\textbf{$$\omega_r^{trackonly-sat}$$}', '\textbf{$$\omega_r^{1step}$$}', '\textbf{$$\omega_l^{trackonly-sat}$$}', '\textbf{$$\omega_l^{1step}$$}')
export_fig(gcf, '-transparent', [dir, 'input_diff_track_1step_1x2.eps'])
clf; plot_input_diff(t{1}, t{2}, U{1}, U{2}, 1, '\textbf{$$\omega_r^{trackonly-sat}$$}', '\textbf{$$\omega_r^{1step}$$}', '\textbf{$$\omega_l^{trackonly-sat}$$}', '\textbf{$$\omega_l^{1step}$$}')
export_fig(gcf, '-transparent', [dir, 'input_diff_track_1step_2x1.eps'])
% input difference (saturated track only, multistep)
clf; plot_input_diff(t{2}, t{3}, U{2}, U{3}, 0, '\textbf{$$\omega_r^{1step}$$}', '\textbf{$$\omega_r^{multistep}$$}', '\textbf{$$\omega_l^{1step}$$}', '\textbf{$$\omega_l^{multistep}$$}')
export_fig(gcf, '-transparent', [dir, 'input_diff_1step_multistep_1x2.eps'])
clf; plot_input_diff(t{2}, t{3}, U{2}, U{3}, 1, '\textbf{$$\omega_r^{1step}$$}', '\textbf{$$\omega_r^{multistep}$$}', '\textbf{$$\omega_l^{1step}$$}', '\textbf{$$\omega_l^{multistep}$$}')
export_fig(gcf, '-transparent', [dir, 'input_diff_1step_multistep_2x1.eps'])
clf; plot_input_diff(t{3}, U_corr{3}, U_corr{2},0)
export_fig(gcf, '-transparent', [dir, num2str(n), 'corr_input_diff_1x2.eps'])
%print([dir, 'corr_input_diff_1x2.png'], '-dpng')
clf; plot_input_diff(t{3}, U_corr{3}, U_corr{2},1)
export_fig(gcf, '-transparent', [dir, num2str(n), 'corr_input_diff_2x1.eps'])
%print([dir, 'corr_input_diff_2x1.png'], '-dpng')
end

View File

@ -1,4 +1,16 @@
function plot_input(t, U_corr1, U_corr2, type)
function plot_input_diff(t1, t2, U_corr1, U_corr2, type, name1_1, name1_2, name2_1, name2_2)
l1 = length(U_corr1);
l2 = length(U_corr2)
t = t1;
if l1 > l2
U_corr1 = U_corr1(1:l2, :);
t = t2;
elseif l2 > l1
U_corr2 = U_corr2(1:l1, :);
t = t1;
end
tiledlayout(1,1,'Padding','tight', 'TileSpacing','compact')
nexttile
@ -10,7 +22,7 @@ subplot(2,1,1);
end
plot(t, U_corr1(:, 1) - U_corr2(:,1), 'Linewidth', 5);
xlabel('\textbf{t[s]}', 'FontSize', 24, 'Interpreter','latex');
ylabel('\textbf{$$\omega_r^{corr, multistep}$$} - \textbf{$$\omega_r^{corr, 1step}$$ [rad/s]}', 'FontSize', 18, 'Interpreter','latex');
ylabel([name1_1 '-' name1_2], 'FontSize', 18, 'Interpreter','latex');
Axes = gca;
Axes.FontSize=18;
@ -26,7 +38,7 @@ subplot(2,1,2);
end
plot(t, U_corr1(:, 2) - U_corr2(:,2), 'Linewidth', 5);
xlabel('\textbf{t[s]}', 'FontSize', 24, 'Interpreter','latex');
ylabel('\textbf{$$\omega_l^{corr, multistep}$$} - \textbf{$$\omega_l^{corr, 1step}$$ [rad/s]}', 'FontSize', 18, 'Interpreter','latex');
ylabel([name2_1 '-' name2_2], 'FontSize', 18, 'Interpreter','latex');
Axes = gca;
Axes.FontSize=18;