nass-simscape/Identification/compare_measurements.m
Thomas Dehaeze 5587309cfa [major changes] Add some control on the system
Add many scripts to:
- define all the inputs for various experiments
- plot the time and frequency data
- identify the plant
2018-06-07 18:27:02 +02:00

140 lines
4.6 KiB
Matlab

%% Script Description
%
%%
clear;
close all;
clc
%% Get Measurement Object
% load('~/ownCloud/Measurements/2017-11-17 - Marc/data/2017_11_17.mat', 'm_object')
load([char(java.lang.System.getProperty('user.home')), '\ownCloud\Measurements\2018-01-12 - Marc\data\2018_01_12_pc.mat'], 'm_object')
%% Get Measurements
% Define Options for measurements
meas_opts = struct( ...
'coh_min', 50, ...
'freq_min', 20 ...
);
measure_dirs = {{'tx', 'tx'}, {'ty', 'ty'}, {'tz', 'tz'}};
% Get measures
measures = getAllMeasure(m_object, 'marble', 'hexa', measure_dirs, meas_opts);
%%
load('../mat/id_G_h_h.mat', 'G_h_h');
load('../mat/id_G_g_g.mat', 'G_g_g');
load('../mat/id_G_h_g.mat', 'G_h_g');
%%
freqs = logspace(-1, 3, 2000);
%% Granite to Granite
figure;
hold on;
plot(measures.Fmx.Dmx.freq_filt, abs(measures.Fmx.Dmx.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_g_g(1, 1), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(Granite)_x \rightarrow D(granite)_x$');
exportFig('comp_model_meas_Fmx_Dmx');
%
figure;
hold on;
plot(measures.Fmy.Dmy.freq_filt, abs(measures.Fmy.Dmy.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_g_g(2, 2), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(Granite)_y \rightarrow D(granite)_y$');
exportFig('comp_model_meas_Fmy_Dmy');
%
figure;
hold on;
plot(measures.Fmz.Dmz.freq_filt, abs(measures.Fmz.Dmz.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_g_g(3, 3), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(Granite)_z \rightarrow D(granite)_z$');
exportFig('comp_model_meas_Fmz_Dmz');
%% Hexapod to Hexapod
figure;
hold on;
plot(measures.Fhx.Dhx.freq_filt, abs(measures.Fhx.Dhx.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_h_h(1, 1), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(\mu Hexapod)_x \rightarrow D(\mu Hexapod)_x$');
exportFig('comp_model_meas_Fhx_Dhx');
%
figure;
hold on;
plot(measures.Fhy.Dhy.freq_filt, abs(measures.Fhy.Dhy.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_h_h(2, 2), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(\mu Hexapod)_y \rightarrow D(\mu Hexapod)_y$');
exportFig('comp_model_meas_Fhy_Dhy');
%
figure;
hold on;
plot(measures.Fhz.Dhz.freq_filt, abs(measures.Fhz.Dhz.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_h_h(3, 3), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(\mu Hexapod)_z \rightarrow D(\mu Hexapod)_z$');
exportFig('comp_model_meas_Fhz_Dhz');
%% Hexapod to Granite
figure;
hold on;
plot(measures.Fhx.Dmx.freq_filt, abs(measures.Fhx.Dmx.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_h_g(1, 1), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(\mu Hexapod)_x \rightarrow D(Granite)_x$');
exportFig('comp_model_meas_Fhx_Dmx');
%
figure;
hold on;
plot(measures.Fhy.Dmy.freq_filt, abs(measures.Fhy.Dmy.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_h_g(2, 2), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(\mu Hexapod)_y \rightarrow D(Granite)_y$');
exportFig('comp_model_meas_Fhy_Dmy');
%
figure;
hold on;
plot(measures.Fhz.Dmz.freq_filt, abs(measures.Fhz.Dmz.resp_filt))
plot(freqs, abs(squeeze(freqresp(G_h_g(3, 3), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [$Hz$]'); ylabel('Amplitude [$m/N$]');
legend({'meas.', 'id.'}, 'location', 'northwest');
title('Transfer function: $F(\mu Hexapod)_z \rightarrow D(Granite)_z$');
exportFig('comp_model_meas_Fhz_Dmz');