nass-micro-station-measurem.../slip-ring-electrical-noise/matlab/meas_slip_ring_geophone.m

58 lines
1.4 KiB
Mathematica
Raw Normal View History

% Matlab Init :noexport:ignore:
current_dir='/home/thomas/MEGA/These/meas/slip-ring-test/';
%% Go to current Directory
cd(current_dir);
%% Initialize ans with org-babel
ans = 0;
%% 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.
d8 = load('mat/data_018.mat', 'data'); d8 = d8.data;
d9 = load('mat/data_019.mat', 'data'); d9 = d9.data;
% Analysis - Time Domain
% First, we compare the time domain signals for the two experiments (figure [[fig:slipring_time]]).
figure;
hold on;
plot(d9(:, 3), d9(:, 2), 'DisplayName', 'Slip-Ring');
plot(d8(:, 3), d8(:, 2), 'DisplayName', 'Wire');
hold off;
xlabel('Time [s]'); ylabel('Voltage [V]');
xlim([0, 50]);
legend('location', 'northeast');
% Analysis - Frequency Domain
% We then compute the Power Spectral Density of the two signals and we compare them (figure [[fig:slipring_asd]]).
dt = d8(2, 3) - d8(1, 3);
Fs = 1/dt;
win = hanning(ceil(1*Fs));
[pxx8, f] = pwelch(d8(:, 2), win, [], [], Fs);
[pxx9, ~] = pwelch(d9(:, 2), win, [], [], Fs);
figure;
hold on;
plot(f, sqrt(pxx9), 'DisplayName', 'Slip-Ring');
plot(f, sqrt(pxx8), 'DisplayName', 'Wire');
hold off;
set(gca, 'xscale', 'log');
set(gca, 'yscale', 'log');
xlabel('Frequency [Hz]'); ylabel('Amplitude Spectral Density $\left[\frac{V}{\sqrt{Hz}}\right]$')
xlim([1, 500]);
legend('Location', 'southwest');