nass-simscape/Analysis/analysis_perturbations.m

28 lines
884 B
Mathematica
Raw Normal View History

2018-06-16 22:57:54 +02:00
%%
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');
2018-06-16 22:57:54 +02:00
%% 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')