Change one measurement of folder

This commit is contained in:
2019-05-15 17:24:56 +02:00
parent 8f0cd2d3c0
commit 65b83cfb48
24 changed files with 1370 additions and 962 deletions

View File

@@ -0,0 +1,124 @@
%% 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.
m_ty = load('mat/data_010.mat', 'data'); m_ty = m_ty.data;
m_ry = load('mat/data_011.mat', 'data'); m_ry = m_ry.data;
ty_ry = load('mat/data_012.mat', 'data'); ty_ry = ty_ry.data;
% Analysis - Time Domain
% First, we can look at the time domain data.
figure;
hold on;
plot(m_ty(:, 3), m_ty(:, 1), 'DisplayName', 'Marble');
plot(m_ty(:, 3), m_ty(:, 2), 'DisplayName', 'Ty');
hold off;
xlabel('Time [s]'); ylabel('Voltage [V]');
legend('Location', 'northeast');
xlim([0, 500]);
% #+NAME: fig:time_domain_m_ty
% #+CAPTION: Time domain - Marble and translation stage
% #+RESULTS: fig:time_domain_m_ty
% [[file:figs/time_domain_m_ty.png]]
figure;
hold on;
plot(m_ry(:, 3), m_ry(:, 1), 'DisplayName', 'Marble');
plot(m_ry(:, 3), m_ry(:, 2), 'DisplayName', 'Ty');
hold off;
xlabel('Time [s]'); ylabel('Voltage [V]');
legend('Location', 'northeast');
xlim([0, 500]);
% #+NAME: fig:time_domain_m_ry
% #+CAPTION: Time domain - Marble and tilt stage
% #+RESULTS: fig:time_domain_m_ry
% [[file:figs/time_domain_m_ry.png]]
figure;
hold on;
plot(ty_ry(:, 3), ty_ry(:, 1), 'DisplayName', 'Ty');
plot(ty_ry(:, 3), ty_ry(:, 2), 'DisplayName', 'Ry');
hold off;
xlabel('Time [s]'); ylabel('Voltage [V]');
legend('Location', 'northeast');
xlim([0, 500]);
% Analysis - Frequency Domain
dt = m_ty(2, 3) - m_ty(1, 3);
Fs = 1/dt;
win = hanning(ceil(1*Fs));
% First, we compute the transfer function estimate between the two geophones for the 3 experiments (figure [[fig:compare_tf_geophones]]). We also plot their coherence (figure [[fig:coherence_two_geophones]]).
[T_m_ty, f] = tfestimate(m_ty(:, 1), m_ty(:, 2), win, [], [], Fs);
[T_m_ry, ~] = tfestimate(m_ry(:, 1), m_ry(:, 2), win, [], [], Fs);
[T_ty_ry, ~] = tfestimate(ty_ry(:, 1), ty_ry(:, 2), win, [], [], Fs);
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(f, abs(T_m_ty), 'DisplayName', 'Marble - Ty');
plot(f, abs(T_m_ry), 'DisplayName', 'Marble - Ry');
plot(f, abs(T_ty_ry), 'DisplayName', 'Ty - Ry');
hold off;
set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log');
set(gca, 'XTickLabel',[]);
ylabel('Magnitude');
legend('Location', 'northwest');
ax2 = subplot(2, 1, 2);
hold on;
plot(f, mod(180+180/pi*phase(T_m_ty), 360)-180);
plot(f, mod(180+180/pi*phase(T_m_ry), 360)-180);
plot(f, mod(180+180/pi*phase(T_ty_ry), 360)-180);
hold off;
set(gca, 'xscale', 'log');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
xlabel('Frequency [Hz]'); ylabel('Phase');
linkaxes([ax1,ax2],'x');
xlim([10, 500]);
% #+NAME: fig:compare_tf_geophones
% #+CAPTION: Transfer function from the first geophone to the second geophone for the three experiments
% #+RESULTS: fig:compare_tf_geophones
% [[file:figs/compare_tf_geophones.png]]
[coh_m_ty, f] = mscohere(m_ty(:, 1), m_ty(:, 2), win, [], [], Fs);
[coh_m_ry, ~] = mscohere(m_ry(:, 1), m_ry(:, 2), win, [], [], Fs);
[coh_ty_ry, ~] = mscohere(ty_ry(:, 1), ty_ry(:, 2), win, [], [], Fs);
figure;
hold on;
plot(f, coh_m_ty, 'DisplayName', 'Marble - Ty');
plot(f, coh_m_ry, 'DisplayName', 'Marble - Ry');
plot(f, coh_ty_ry, 'DisplayName', 'Ty - Ry');
hold off;
set(gca, 'xscale', 'log');
xlabel('Frequency [Hz]'); ylabel('Coherence');
ylim([0, 1]); xlim([1, 500]);