nass-micro-station-measurem.../slip-ring-noise-turning/matlab/meas_slip_ring.m

85 lines
2.4 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.
sr_off = load('mat/data_008.mat', 'data'); sr_off = sr_off.data;
sr_on = load('mat/data_009.mat', 'data'); sr_on = sr_on.data;
sr_6r = load('mat/data_010.mat', 'data'); sr_6r = sr_6r.data;
sr_60r = load('mat/data_011.mat', 'data'); sr_60r = sr_60r.data;
% Time Domain
% We plot the time domain data for the direct measurement (figure [[fig:sr_direct_time]]) and for the signal going through the slip-ring (figure [[fig:sr_slipring_time]]);
figure;
hold on;
plot(sr_60r(:, 3), sr_60r(:, 1), 'DisplayName', '60rpm');
plot(sr_6r(:, 3), sr_6r(:, 1), 'DisplayName', '6rpm');
plot(sr_on(:, 3), sr_on(:, 1), 'DisplayName', 'ON');
plot(sr_off(:, 3), sr_off(:, 1), 'DisplayName', 'OFF');
hold off;
xlabel('Time [s]'); ylabel('Voltage [V]');
legend('Location', 'northeast');
% #+NAME: fig:sr_direct_time
% #+CAPTION: Direct measurement
% #+RESULTS: fig:sr_direct_time
% [[file:figs/sr_direct_time.png]]
figure;
hold on;
plot(sr_60r(:, 3), sr_60r(:, 2), 'DisplayName', '60rpm');
plot(sr_6r(:, 3), sr_6r(:, 2), 'DisplayName', '6rpm');
plot(sr_on(:, 3), sr_on(:, 2), 'DisplayName', 'ON');
plot(sr_off(:, 3), sr_off(:, 2), 'DisplayName', 'OFF');
hold off;
xlabel('Time [s]'); ylabel('Voltage [V]');
legend('Location', 'northeast');
% Frequency Domain
% We first compute some parameters that will be used for the PSD computation.
dt = sr_off(2, 3)-sr_off(1, 3);
Fs = 1/dt; % [Hz]
win = hanning(ceil(10*Fs));
% Then we compute the Power Spectral Density using =pwelch= function.
[pxdir, f] = pwelch(sr_off(:, 1), win, [], [], Fs);
[pxoff, ~] = pwelch(sr_off(:, 2), win, [], [], Fs);
[pxon, ~] = pwelch(sr_on(:, 2), win, [], [], Fs);
[px6r, ~] = pwelch(sr_6r(:, 2), win, [], [], Fs);
[px60r, ~] = pwelch(sr_60r(:, 2), win, [], [], Fs);
% And we plot the ASD of the measured signals (figure [[fig:sr_psd_compare]]);
figure;
hold on;
plot(f, sqrt(pxoff), 'DisplayName', 'OFF');
plot(f, sqrt(pxon), 'DisplayName', 'ON');
plot(f, sqrt(px6r), 'DisplayName', '6rpm');
plot(f, sqrt(px60r), 'DisplayName', '60rpm');
plot(f, sqrt(pxdir), 'k-', 'DisplayName', 'Direct');
hold off;
set(gca, 'xscale', 'log');
set(gca, 'yscale', 'log');
xlabel('Frequency [Hz]'); ylabel('ASD of the measured Voltage $\left[\frac{V}{\sqrt{Hz}}\right]$')
legend('Location', 'northeast');
xlim([0.1, 500]);