nass-simscape/identification/matlab-old/id_flexible_rigid_plots.m

100 lines
3.1 KiB
Matlab

%% Script Description
% Determine if we take into account the flexibilities,
% does that changes a lot
%%
clear; close all; clc;
%% Load Configuration file
load('./mat/config.mat', 'save_fig', 'freqs');
%% Load the obtained transfer functions
load('./mat/id_micro_station_flexibility.mat', 'G_ms_flexible', 'G_ms_ty_rigid');
%% Get Measurement Object
load('2018_01_12.mat', 'm_object');
% Get Measurements Data
opts = struct('freq_min', 10, 'est_backend', 'idfrd');
meas_sys = getDynamicTFs(m_object, 'marble', 'hexa', {{'tx', 'tx'},{'ty', 'ty'},{'tz', 'tz'}}, opts);
%%
dir = 'y';
figure;
% Amplitude
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'))), '--');
set(gca,'xscale','log'); set(gca,'yscale','log');
ylabel('Amplitude [m/N]');
set(gca, 'XTickLabel',[]);
legend({'Flexible', 'Ty - Rigid'});
hold off;
% Phase
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'))), '--');
set(gca,'xscale','log');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
hold off;
linkaxes([ax1,ax2],'x');
%%
dir = 'y';
figure;
% Amplitude
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'))), '--');
set(gca,'xscale','log'); set(gca,'yscale','log');
ylabel('Amplitude [m/N]');
set(gca, 'XTickLabel',[]);
legend({'Flexible', 'Ty - Rigid'});
hold off;
% Phase
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'))), '--');
set(gca,'xscale','log');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
hold off;
linkaxes([ax1,ax2],'x');
%%
dir = 'z';
figure;
% Amplitude
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'))), '--');
plot(freqs, abs(squeeze(freqresp(meas_sys(['Dm' dir], ['Fh' dir]), freqs, 'Hz'))), '.');
set(gca,'xscale','log'); set(gca,'yscale','log');
ylabel('Amplitude [m/N]');
set(gca, 'XTickLabel',[]);
legend({'Flexible', 'Ty - Rigid'});
hold off;
% Phase
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'))), '--');
plot(freqs, 180/pi*angle(squeeze(freqresp(meas_sys(['Dm' dir], ['Fh' dir]), freqs, 'Hz'))), '.');
set(gca,'xscale','log');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
hold off;
linkaxes([ax1,ax2],'x');