nass-simscape/Analysis/analysis_perturbations.m
Thomas Dehaeze 7575aee987 Add metrology element (change of base, computation of error)
Lot's of new things:
- try to use less .mat files
- computation of setpoint and error in the cartesian frame fixed to the granite
- change of base to have the errors w.r.t. the NASS base
- add script to plot setpoint, position and error
2018-10-24 15:08:23 +02:00

28 lines
884 B
Matlab

%%
clear; close all; clc;
%% Load Plant
load('./mat/G_xg_to_d.mat', 'G_xg_to_d');
%% Load shape of the perturbation
load('./mat/perturbations.mat', 'Wxg');
%% Effect of the perturbation on the output
freqs = logspace(-1, 3, 1000);
dx_out = squeeze(abs(freqresp(Wxg*G_xg_to_d(1, 1), freqs, 'Hz')));
dy_out = squeeze(abs(freqresp(Wxg*G_xg_to_d(2, 2), freqs, 'Hz')));
dz_out = squeeze(abs(freqresp(Wxg*G_xg_to_d(3, 3), freqs, 'Hz')));
figure;
hold on;
plot(freqs, dx_out, 'DisplayName', 'Effect of $Dg$ on $D_{x}$');
plot(freqs, dy_out, 'DisplayName', 'Effect of $Dg$ on $D_{y}$');
plot(freqs, dz_out, 'DisplayName', 'Effect of $Dg$ on $D_{z}$');
xlabel('Frequency [Hz]'); ylabel('PSD [$m/\sqrt{Hz}$]');
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
legend('location', 'southwest');
xlim([freqs(1), freqs(end)]);
hold off;
exportFig('ground_motion_effect', 'normal-normal')