nass-micro-station-measurem.../disturbance-control-system/matlab/effect_control_one.m
2019-05-14 10:23:44 +02:00

122 lines
4.1 KiB
Matlab

%% Clear Workspace and Close figures
clear; close all; clc;
%% Intialize Laplace variable
s = zpk('s');
% Load data
% We load the data of the z axis of two geophones.
d_of = load('mat/data_013.mat', 'data'); d_of = d_of.data;
d_ty = load('mat/data_014.mat', 'data'); d_ty = d_ty.data;
d_ry = load('mat/data_015.mat', 'data'); d_ry = d_ry.data;
d_sr = load('mat/data_016.mat', 'data'); d_sr = d_sr.data;
d_rz = load('mat/data_017.mat', 'data'); d_rz = d_rz.data;
d_he = load('mat/data_018.mat', 'data'); d_he = d_he.data;
% Analysis - Time Domain
% First, we can look at the time domain data and compare all the measurements:
% - comparison for the geophone at the sample location (figure [[fig:time_domain_sample_lpf]])
% - comparison for the geophone on the granite (figure [[fig:time_domain_marble_lpf]])
figure;
hold on;
plot(d_of(:, 3), d_of(:, 2), 'DisplayName', 'All OFF';
plot(d_ty(:, 3), d_ty(:, 2), 'DisplayName', 'Ty ON');
plot(d_ry(:, 3), d_ry(:, 2), 'DisplayName', 'Ry ON');
plot(d_sr(:, 3), d_sr(:, 2), 'DisplayName', 'S-R ON');
plot(d_rz(:, 3), d_rz(:, 2), 'DisplayName', 'Rz ON');
plot(d_he(:, 3), d_he(:, 2), 'DisplayName', 'Hexa ON');
hold off;
xlabel('Time [s]'); ylabel('Voltage [V]');
xlim([0, 50]);
legend('Location', 'bestoutside');
% #+NAME: fig:time_domain_sample_lpf
% #+CAPTION: Comparison of the time domain data when turning off the control system of the stages - Geophone at the sample location
% #+RESULTS: fig:time_domain_sample_lpf
% [[file:figs/time_domain_sample_lpf.png]]
figure;
hold on;
plot(d_of(:, 3), d_of(:, 1), 'DisplayName', 'All OFF');
plot(d_ty(:, 3), d_ty(:, 1), 'DisplayName', 'Ty ON');
plot(d_ry(:, 3), d_ry(:, 1), 'DisplayName', 'Ry ON');
plot(d_sr(:, 3), d_sr(:, 1), 'DisplayName', 'S-R ON');
plot(d_rz(:, 3), d_rz(:, 1), 'DisplayName', 'Rz ON');
plot(d_he(:, 3), d_he(:, 1), 'DisplayName', 'Hexa ON');
hold off;
xlabel('Time [s]'); ylabel('Voltage [V]');
xlim([0, 50]);
legend('Location', 'bestoutside');
% Analysis - Frequency Domain
dt = d_of(2, 3) - d_of(1, 3);
Fs = 1/dt;
win = hanning(ceil(10*Fs));
% Vibrations at the sample location
% First, we compute the Power Spectral Density of the signals coming from the Geophone located at the sample location.
[px_of, f] = pwelch(d_of(:, 2), win, [], [], Fs);
[px_ty, ~] = pwelch(d_ty(:, 2), win, [], [], Fs);
[px_ry, ~] = pwelch(d_ry(:, 2), win, [], [], Fs);
[px_sr, ~] = pwelch(d_sr(:, 2), win, [], [], Fs);
[px_rz, ~] = pwelch(d_rz(:, 2), win, [], [], Fs);
[px_he, ~] = pwelch(d_he(:, 2), win, [], [], Fs);
% And we compare all the signals (figures [[fig:psd_sample_comp_lpf]] and [[fig:psd_sample_comp_high_freq_lpf]]).
figure;
hold on;
plot(f, sqrt(px_of), 'DisplayName', 'All OFF');
plot(f, sqrt(px_ty), 'DisplayName', 'Ty ON');
plot(f, sqrt(px_ry), 'DisplayName', 'Ry ON');
plot(f, sqrt(px_sr), 'DisplayName', 'S-R ON');
plot(f, sqrt(px_rz), 'DisplayName', 'Rz ON');
plot(f, sqrt(px_he), 'DisplayName', 'Hexa ON');
hold off;
set(gca, 'xscale', 'log');
set(gca, 'yscale', 'log');
xlabel('Frequency [Hz]'); ylabel('Amplitude Spectral Density $\left[\frac{V}{\sqrt{Hz}}\right]$')
xlim([0.1, 500]);
legend('Location', 'southwest');
% Vibrations on the marble
% Now we plot the same curves for the geophone located on the marble.
[px_of, f] = pwelch(d_of(:, 1), win, [], [], Fs);
[px_ty, ~] = pwelch(d_ty(:, 1), win, [], [], Fs);
[px_ry, ~] = pwelch(d_ry(:, 1), win, [], [], Fs);
[px_sr, ~] = pwelch(d_sr(:, 1), win, [], [], Fs);
[px_rz, ~] = pwelch(d_rz(:, 1), win, [], [], Fs);
[px_he, ~] = pwelch(d_he(:, 1), win, [], [], Fs);
% And we compare the Amplitude Spectral Densities (figures [[fig:psd_marble_comp_lpf]] and [[fig:psd_marble_comp_lpf_high_freq]])
figure;
hold on;
plot(f, sqrt(px_of), 'DisplayName', 'All OFF');
plot(f, sqrt(px_ty), 'DisplayName', 'Ty ON');
plot(f, sqrt(px_ry), 'DisplayName', 'Ry ON');
plot(f, sqrt(px_sr), 'DisplayName', 'S-R ON');
plot(f, sqrt(px_rz), 'DisplayName', 'Rz ON');
plot(f, sqrt(px_he), 'DisplayName', 'Hexa ON');
hold off;
set(gca, 'xscale', 'log');
set(gca, 'yscale', 'log');
xlabel('Frequency [Hz]'); ylabel('Amplitude Spectral Density $\left[\frac{V}{\sqrt{Hz}}\right]$')
xlim([0.1, 500]);
legend('Location', 'northeast');