nass-simscape/analysis/matlab-old/tomography_ol_cl.m

69 lines
1.7 KiB
Matlab

%%
clear; close all; clc;
%%
tomo_ol = load('./data/tomography_exp_ol.mat', 'Dmeas');
tomo_cl = load('./data/tomography_exp.mat', 'Dmeas');
%% Compare OL and CL - Time
figure;
hold on;
plot(tomo_ol.Dmeas.Time, tomo_ol.Dmeas.Data(:, 1));
plot(tomo_cl.Dmeas.Time, tomo_cl.Dmeas.Data(:, 1));
legend({'x - OL', 'x - CL'})
hold off;
xlabel('Time [s]'); ylabel('Displacement [m]');
exportFig('tomo_control_time_x', 'normal-normal')
figure;
hold on;
plot(tomo_ol.Dmeas.Time, tomo_ol.Dmeas.Data(:, 2));
plot(tomo_cl.Dmeas.Time, tomo_cl.Dmeas.Data(:, 2));
legend({'y - OL', 'y - CL'})
hold off;
xlabel('Time [s]'); ylabel('Displacement [m]');
exportFig('tomo_control_time_y', 'normal-normal')
figure;
hold on;
plot(tomo_ol.Dmeas.Time, tomo_ol.Dmeas.Data(:, 3));
plot(tomo_cl.Dmeas.Time, tomo_cl.Dmeas.Data(:, 3));
legend({'z - OL', 'z - CL'})
hold off;
xlabel('Time [s]'); ylabel('Displacement [m]');
exportFig('tomo_control_time_z', 'normal-normal')
%%
figure;
hold on;
plot(tomo_ol.Dmeas.Data(:, 1),tomo_ol.Dmeas.Data(:, 3))
plot(tomo_cl.Dmeas.Data(:, 1),tomo_cl.Dmeas.Data(:, 3))
legend({'OL', 'CL'})
hold off;
xlabel('Displacement - $x$ [s]'); ylabel('Displacement - $z$ [m]');
%% Compare OL and CL - PSD
han_windows_ol = hanning(ceil(length(tomo_ol.Dmeas.Time)/10));
[psd_y_ol, freqs_y_ol] = pwelch(tomo_ol.Dmeas.Data(:, 2), han_windows, 0, [], 1/Ts);
han_windows = hanning(ceil(length(tomo_cl.Dmeas.Time)/10));
[psd_y, freqs_y] = pwelch(tomo_cl.Dmeas.Data(:, 2), han_windows, 0, [], 1/Ts);
figure;
hold on;
plot(freqs_y_ol, sqrt(psd_y_ol));
plot(freqs_y, sqrt(psd_y));
set(gca,'xscale','log'); set(gca,'yscale','log');
xlabel('Frequency [Hz]'); ylabel('PSD [$m/\sqrt{Hz}$]');
legend({'y - OL', 'y - CL'})
hold off;
exportFig('tomo_control_psd_y', 'normal-normal')