From cdbd62b3eeb4f4affec74aa7539ca6c6e52f592d Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Mon, 14 Oct 2019 16:45:24 +0200 Subject: [PATCH] Change subaxis to subplot --- active_damping/iff_comp_tf.m | 4 ++-- hac_lac/hac_lac_iff_control_plots.m | 16 ++++++++-------- identification/id_G_cart_plots.m | 10 +++++----- identification/id_G_iff_plots.m | 6 +++--- identification/id_flexible_rigid_plots.m | 12 ++++++------ identification/id_micro_station_comp_meas.m | 14 +++++++------- kinematics/error_NASS.m | 12 ++++++------ kinematics/setpoint_vs_position.m | 12 ++++++------ src/init_simulation.m | 4 ++-- 9 files changed, 45 insertions(+), 45 deletions(-) diff --git a/active_damping/iff_comp_tf.m b/active_damping/iff_comp_tf.m index 0559cc6..1bcae45 100644 --- a/active_damping/iff_comp_tf.m +++ b/active_damping/iff_comp_tf.m @@ -11,7 +11,7 @@ load('./mat/config.mat', 'save_fig', 'freqs'); %% New Plant damped figure; % Amplitude -ax1 = subaxis(2,1,1); +ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), '-', 'DisplayName', 'Light VC'); plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), '-', 'DisplayName', 'Light PZ'); @@ -24,7 +24,7 @@ set(gca, 'XTickLabel',[]); legend('Location', 'southwest'); hold off; % Phase -ax2 = subaxis(2,1,2); +ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), '-'); plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), '-'); diff --git a/hac_lac/hac_lac_iff_control_plots.m b/hac_lac/hac_lac_iff_control_plots.m index c803fba..3d15d51 100644 --- a/hac_lac/hac_lac_iff_control_plots.m +++ b/hac_lac/hac_lac_iff_control_plots.m @@ -11,7 +11,7 @@ load('./mat/config.mat', 'save_fig', 'freqs'); %% Plot the Loop gain for Translations - Light VC figure; % Amplitude -ax1 = subaxis(2,1,1); +ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(K_light_vc_iff(1, 1)*G_iff_light_vc.G_cart(1, 1), freqs, 'Hz'))), 'DisplayName', 'x'); plot(freqs, abs(squeeze(freqresp(K_light_vc_iff(2, 2)*G_iff_light_vc.G_cart(2, 2), freqs, 'Hz'))), 'DisplayName', 'y'); @@ -21,7 +21,7 @@ set(gca, 'XTickLabel',[]); ylabel('Amplitude [m/N]'); hold off; % Phase -ax2 = subaxis(2,1,2); +ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(K_light_vc_iff(1, 1)*G_iff_light_vc.G_cart(1, 1), freqs, 'Hz')))); plot(freqs, 180/pi*angle(squeeze(freqresp(K_light_vc_iff(2, 2)*G_iff_light_vc.G_cart(2, 2), freqs, 'Hz')))); @@ -39,7 +39,7 @@ if save_fig; exportFig('loop_gain_fb_iff_light_vc_trans', 'normal-normal', struc %% Plot the Loop gain for Rotations - Light VC figure; % Amplitude -ax1 = subaxis(2,1,1); +ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(K_light_vc_iff(4, 4)*G_iff_light_vc.G_cart(4, 4), freqs, 'Hz'))), 'DisplayName', 'Rx'); plot(freqs, abs(squeeze(freqresp(K_light_vc_iff(5, 5)*G_iff_light_vc.G_cart(5, 5), freqs, 'Hz'))), 'DisplayName', 'Ry'); @@ -48,7 +48,7 @@ set(gca, 'XTickLabel',[]); ylabel('Amplitude [m/N]'); hold off; % Phase -ax2 = subaxis(2,1,2); +ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(K_light_vc_iff(4, 4)*G_iff_light_vc.G_cart(4, 4), freqs, 'Hz')))); plot(freqs, 180/pi*angle(squeeze(freqresp(K_light_vc_iff(5, 5)*G_iff_light_vc.G_cart(5, 5), freqs, 'Hz')))); @@ -65,7 +65,7 @@ if save_fig; exportFig('loop_gain_fb_iff_light_vc_rot', 'normal-normal', struct( %% Plot the Loop gain for Translations - Light PZ figure; % Amplitude -ax1 = subaxis(2,1,1); +ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(K_light_pz_iff(1, 1)*G_iff_light_pz.G_cart(1, 1), freqs, 'Hz'))), 'DisplayName', 'x'); plot(freqs, abs(squeeze(freqresp(K_light_pz_iff(2, 2)*G_iff_light_pz.G_cart(2, 2), freqs, 'Hz'))), 'DisplayName', 'y'); @@ -75,7 +75,7 @@ set(gca, 'XTickLabel',[]); ylabel('Amplitude [m/N]'); hold off; % Phase -ax2 = subaxis(2,1,2); +ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(K_light_pz_iff(1, 1)*G_iff_light_pz.G_cart(1, 1), freqs, 'Hz')))); plot(freqs, 180/pi*angle(squeeze(freqresp(K_light_pz_iff(2, 2)*G_iff_light_pz.G_cart(2, 2), freqs, 'Hz')))); @@ -93,7 +93,7 @@ if save_fig; exportFig('loop_gain_fb_iff_light_pz_trans', 'normal-normal', struc %% Plot the Loop gain for Rotations - Light PZ figure; % Amplitude -ax1 = subaxis(2,1,1); +ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(K_light_pz_iff(4, 4)*G_iff_light_pz.G_cart(4, 4), freqs, 'Hz'))), 'DisplayName', 'Rx'); plot(freqs, abs(squeeze(freqresp(K_light_pz_iff(5, 5)*G_iff_light_pz.G_cart(5, 5), freqs, 'Hz'))), 'DisplayName', 'Ry'); @@ -102,7 +102,7 @@ set(gca, 'XTickLabel',[]); ylabel('Amplitude [m/N]'); hold off; % Phase -ax2 = subaxis(2,1,2); +ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(K_light_pz_iff(4, 4)*G_iff_light_pz.G_cart(4, 4), freqs, 'Hz')))); plot(freqs, 180/pi*angle(squeeze(freqresp(K_light_pz_iff(5, 5)*G_iff_light_pz.G_cart(5, 5), freqs, 'Hz')))); diff --git a/identification/id_G_cart_plots.m b/identification/id_G_cart_plots.m index 6f5bf9f..c315252 100644 --- a/identification/id_G_cart_plots.m +++ b/identification/id_G_cart_plots.m @@ -10,7 +10,7 @@ load('./mat/config.mat', 'save_fig', 'freqs'); %% Plant figure; % Amplitude -ax1 = subaxis(2,1,1); +ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fnx'), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fnx'), freqs, 'Hz')))); @@ -23,7 +23,7 @@ ylabel('Amplitude [m/N]'); hold off; % Phase -ax2 = subaxis(2,1,2); +ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fnx'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); @@ -44,7 +44,7 @@ if save_fig; exportFig('comp_models_plant_x_x', 'normal-normal', struct('path', %% figure; % Amplitude -ax1 = subaxis(2,1,1); +ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dz', 'Fnz'), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dz', 'Fnz'), freqs, 'Hz')))); @@ -57,7 +57,7 @@ ylabel('Amplitude [m/N]'); hold off; % Phase -ax2 = subaxis(2,1,2); +ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_cart('Dz', 'Fnz'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_cart('Dz', 'Fnz'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); @@ -80,7 +80,7 @@ figure; for i_input = 1:3 for i_output = 1:3 - subaxis(3,3,3*(i_input-1)+i_output); + subplot(3,3,3*(i_input-1)+i_output); hold on; plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart(i_output, i_input), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart(i_output, i_input), freqs, 'Hz')))); diff --git a/identification/id_G_iff_plots.m b/identification/id_G_iff_plots.m index aec98c6..2c0e6d9 100644 --- a/identification/id_G_iff_plots.m +++ b/identification/id_G_iff_plots.m @@ -7,10 +7,10 @@ load('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz'); %% Load Configuration file load('./mat/config.mat', 'save_fig', 'freqs'); -%% +%% figure; % Amplitude -ax1 = subaxis(2,1,1); +ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(G_light_vc.G_iff('Fm1', 'F1'), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(G_light_pz.G_iff('Fm1', 'F1'), freqs, 'Hz')))); @@ -23,7 +23,7 @@ ylabel('Amplitude [m/N]'); hold off; % Phase -ax2 = subaxis(2,1,2); +ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_iff('Fm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'VC - Light'); plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_iff('Fm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light'); diff --git a/identification/id_flexible_rigid_plots.m b/identification/id_flexible_rigid_plots.m index 6e8307e..9e6dbaf 100644 --- a/identification/id_flexible_rigid_plots.m +++ b/identification/id_flexible_rigid_plots.m @@ -23,7 +23,7 @@ dir = 'y'; figure; % Amplitude -ax1 = subaxis(2,1,1); +ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(G_ms_flexible(['Dg' dir], ['Fg' dir]), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(G_ms_ty_rigid(['Dg' dir], ['Fg' dir]), freqs, 'Hz'))), '--'); @@ -33,7 +33,7 @@ set(gca, 'XTickLabel',[]); legend({'Flexible', 'Ty - Rigid'}); hold off; % Phase -ax2 = subaxis(2,1,2); +ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms_flexible(['Dg' dir], ['Fg' dir]), freqs, 'Hz')))); plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms_ty_rigid(['Dg' dir], ['Fg' dir]), freqs, 'Hz'))), '--'); @@ -49,7 +49,7 @@ dir = 'y'; figure; % Amplitude -ax1 = subaxis(2,1,1); +ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(G_ms_flexible(['Dm' dir], ['Fm' dir]), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(G_ms_ty_rigid(['Dm' dir], ['Fm' dir]), freqs, 'Hz'))), '--'); @@ -59,7 +59,7 @@ set(gca, 'XTickLabel',[]); legend({'Flexible', 'Ty - Rigid'}); hold off; % Phase -ax2 = subaxis(2,1,2); +ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms_flexible(['Dm' dir], ['Fm' dir]), freqs, 'Hz')))); plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms_ty_rigid(['Dm' dir], ['Fm' dir]), freqs, 'Hz'))), '--'); @@ -75,7 +75,7 @@ dir = 'z'; figure; % Amplitude -ax1 = subaxis(2,1,1); +ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(G_ms_flexible(['Dg' dir], ['Fm' dir]), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(G_ms_ty_rigid(['Dg' dir], ['Fm' dir]), freqs, 'Hz'))), '--'); @@ -86,7 +86,7 @@ set(gca, 'XTickLabel',[]); legend({'Flexible', 'Ty - Rigid'}); hold off; % Phase -ax2 = subaxis(2,1,2); +ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms_flexible(['Dg' dir], ['Fm' dir]), freqs, 'Hz')))); plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms_ty_rigid(['Dg' dir], ['Fm' dir]), freqs, 'Hz'))), '--'); diff --git a/identification/id_micro_station_comp_meas.m b/identification/id_micro_station_comp_meas.m index 6c02a84..3956426 100644 --- a/identification/id_micro_station_comp_meas.m +++ b/identification/id_micro_station_comp_meas.m @@ -22,7 +22,7 @@ meas_sys = getDynamicTFs(m_object, 'marble', 'hexa', {{'tx', 'tx'},{'ty', 'ty'}, for dir = 'xyz' figure; % Amplitude - ax1 = subaxis(2,1,1); + ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(G_ms(['Dg' dir], ['Fg' dir]), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(meas_sys(['Dm' dir], ['Fm' dir]), freqs, 'Hz'))), '.'); @@ -32,7 +32,7 @@ for dir = 'xyz' legend({'Model', 'Meas.'}); hold off; % Phase - ax2 = subaxis(2,1,2); + ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms(['Dg' dir], ['Fg' dir]), freqs, 'Hz')))); plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys(['Dm' dir], ['Fm' dir]), freqs, 'Hz'))), '.'); @@ -50,7 +50,7 @@ end for dir = 'xyz' figure; % Amplitude - ax1 = subaxis(2,1,1); + ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(G_ms(['Dm' dir], ['Fm' dir]), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(meas_sys(['Dh' dir], ['Fh' dir]), freqs, 'Hz'))), '.'); @@ -60,7 +60,7 @@ for dir = 'xyz' legend({'Model', 'Meas.'}); hold off; % Phase - ax2 = subaxis(2,1,2); + ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms(['Dm' dir], ['Fm' dir]), freqs, 'Hz')))); plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys(['Dh' dir], ['Fh' dir]), freqs, 'Hz'))), '.'); @@ -71,7 +71,7 @@ for dir = 'xyz' hold off; linkaxes([ax1,ax2],'x'); - + if save_fig; exportFig(['comp_meas_m_m_' dir], 'normal-normal', struct('path', 'identification')); end end @@ -79,7 +79,7 @@ end for dir = 'xyz' figure; % Amplitude - ax1 = subaxis(2,1,1); + ax1 = subplot(2,1,1); hold on; plot(freqs, abs(squeeze(freqresp(G_ms(['Dm' dir], ['Fg' dir]), freqs, 'Hz')))); plot(freqs, abs(squeeze(freqresp(meas_sys(['Dh' dir], ['Fm' dir]), freqs, 'Hz'))), '.'); @@ -89,7 +89,7 @@ for dir = 'xyz' legend({'Model', 'Meas.'}); hold off; % Phase - ax2 = subaxis(2,1,2); + ax2 = subplot(2,1,2); hold on; plot(freqs, 180/pi*angle(squeeze(freqresp(G_ms(['Dm' dir], ['Fg' dir]), freqs, 'Hz')))); plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys(['Dh' dir], ['Fm' dir]), freqs, 'Hz'))), '.'); diff --git a/kinematics/error_NASS.m b/kinematics/error_NASS.m index f8cec8d..6ef8d1c 100644 --- a/kinematics/error_NASS.m +++ b/kinematics/error_NASS.m @@ -2,7 +2,7 @@ figure; %% Tx -subaxis(2, 3, 1); +subplot(2, 3, 1); hold on; plot(error_nass.Time, error_nass.Data(:, 1), 'k-', 'DisplayName', '$\epsilon_x$'); legend(); @@ -10,7 +10,7 @@ hold off; xlabel('Time (s)'); ylabel('Position (m)'); %% Ty -subaxis(2, 3, 2); +subplot(2, 3, 2); hold on; plot(error_nass.Time, error_nass.Data(:, 2), 'k-', 'DisplayName', '$\epsilon_y$'); legend(); @@ -18,7 +18,7 @@ hold off; xlabel('Time (s)'); ylabel('Position (m)'); %% Tz -subaxis(2, 3, 3); +subplot(2, 3, 3); hold on; plot(error_nass.Time, error_nass.Data(:, 3), 'k-', 'DisplayName', '$\epsilon_z$'); legend(); @@ -26,7 +26,7 @@ hold off; xlabel('Time (s)'); ylabel('Position (m)'); %% Rx -subaxis(2, 3, 4); +subplot(2, 3, 4); hold on; plot(error_nass.Time, error_nass.Data(:, 4), 'k-', 'DisplayName', '$\epsilon_{\theta_x}$'); legend(); @@ -34,7 +34,7 @@ hold off; xlabel('Time (s)'); ylabel('Rotation (rad)'); %% Ry -subaxis(2, 3, 5); +subplot(2, 3, 5); hold on; plot(error_nass.Time, error_nass.Data(:, 5), 'k-', 'DisplayName', '$\epsilon_{\theta_y}$'); legend(); @@ -42,7 +42,7 @@ hold off; xlabel('Time (s)'); ylabel('Rotation (rad)'); %% Rz -subaxis(2, 3, 6); +subplot(2, 3, 6); hold on; plot(error_nass.Time, error_nass.Data(:, 6), 'k-', 'DisplayName', '$\epsilon_{\theta_z}$'); legend(); diff --git a/kinematics/setpoint_vs_position.m b/kinematics/setpoint_vs_position.m index 917fe85..b139170 100644 --- a/kinematics/setpoint_vs_position.m +++ b/kinematics/setpoint_vs_position.m @@ -2,7 +2,7 @@ figure; %% Tx -subaxis(2, 3, 1); +subplot(2, 3, 1); hold on; plot(pos.Time, pos.Data(:, 1), 'k-'); plot(setpoint.Time, setpoint.Data(:, 1), 'k--'); @@ -11,7 +11,7 @@ hold off; xlabel('Time (s)'); ylabel('Position (m)'); %% Ty -subaxis(2, 3, 2); +subplot(2, 3, 2); hold on; plot(pos.Time, pos.Data(:, 2), 'k-'); plot(setpoint.Time, setpoint.Data(:, 2), 'k--'); @@ -20,7 +20,7 @@ hold off; xlabel('Time (s)'); ylabel('Position (m)'); %% Tz -subaxis(2, 3, 3); +subplot(2, 3, 3); hold on; plot(pos.Time, pos.Data(:, 3), 'k-'); plot(setpoint.Time, setpoint.Data(:, 3), 'k--'); @@ -29,7 +29,7 @@ hold off; xlabel('Time (s)'); ylabel('Position (m)'); %% Rx -subaxis(2, 3, 4); +subplot(2, 3, 4); hold on; plot(pos.Time, pos.Data(:, 4), 'k-'); plot(setpoint.Time, setpoint.Data(:, 4), 'k--'); @@ -38,7 +38,7 @@ hold off; xlabel('Time (s)'); ylabel('Rotation (rad)'); %% Ry -subaxis(2, 3, 5); +subplot(2, 3, 5); hold on; plot(pos.Time, pos.Data(:, 5), 'k-'); plot(setpoint.Time, setpoint.Data(:, 5), 'k--'); @@ -47,7 +47,7 @@ hold off; xlabel('Time (s)'); ylabel('Rotation (rad)'); %% Rz -subaxis(2, 3, 6); +subplot(2, 3, 6); hold on; plot(pos.Time, pos.Data(:, 6), 'k-'); plot(setpoint.Time, setpoint.Data(:, 6), 'k--'); diff --git a/src/init_simulation.m b/src/init_simulation.m index 64a1709..3ec9033 100644 --- a/src/init_simulation.m +++ b/src/init_simulation.m @@ -13,7 +13,7 @@ %% Load all the data used for the simulation -load('./mat/sim_conf.mat'); +load('sim_conf.mat'); %% Load Controller -load('./mat/controllers.mat'); +load('controllers.mat');