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

110 lines
3.2 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_of = load('mat/data_030.mat', 'data'); sr_of = sr_of.data;
sr_on = load('mat/data_031.mat', 'data'); sr_on = sr_on.data;
sr_6r = load('mat/data_032.mat', 'data'); sr_6r = sr_6r.data;
sr_60 = load('mat/data_033.mat', 'data'); sr_60 = sr_60.data;
% Time Domain
% We plot the time domain data for the direct measurement (figure [[fig:sr_direct_1khz_time]]) and for the signal going through the slip-ring (figure [[fig:sr_slipring_1khz_time]]);
figure;
hold on;
plot(sr_60(:, 3), sr_60(:, 1), 'DisplayName', '60rpm');
plot(sr_6r(:, 3), sr_6r(:, 1), 'DisplayName', '6rpm');
plot(sr_on(:, 3), sr_on(:, 1), 'DisplayName', 'ON');
plot(sr_of(:, 3), sr_of(:, 1), 'DisplayName', 'OFF');
hold off;
xlabel('Time [s]'); ylabel('Voltage [V]');
xlim([0, 100]);
legend('Location', 'northeast');
% #+NAME: fig:sr_direct_1khz_time
% #+CAPTION: Direct measurement
% #+RESULTS: fig:sr_direct_1khz_time
% [[file:figs/sr_direct_1khz_time.png]]
xlim([0, 0.2]); ylim([-2e-3, 2e-3]);
% #+NAME: fig:sr_direct_1khz_time_zoom
% #+CAPTION: Direct measurement - Zoom
% #+RESULTS: fig:sr_direct_1khz_time_zoom
% [[file:figs/sr_direct_1khz_time_zoom.png]]
figure;
hold on;
plot(sr_60(:, 3), sr_60(:, 2), 'DisplayName', '60rpm');
plot(sr_6r(:, 3), sr_6r(:, 2), 'DisplayName', '6rpm');
plot(sr_on(:, 3), sr_on(:, 2), 'DisplayName', 'ON');
plot(sr_of(:, 3), sr_of(:, 2), 'DisplayName', 'OFF');
hold off;
xlabel('Time [s]'); ylabel('Voltage [V]');
xlim([0, 100]);
legend('Location', 'northeast');
% Frequency Domain - Direct Signal
% We first compute some parameters that will be used for the PSD computation.
dt = sr_of(2, 3)-sr_of(1, 3);
Fs = 1/dt; % [Hz]
win = hanning(ceil(10*Fs));
% Then we compute the Power Spectral Density using =pwelch= function.
[px_d_of, f] = pwelch(sr_of(:, 1), win, [], [], Fs);
[px_d_on, ~] = pwelch(sr_on(:, 1), win, [], [], Fs);
[px_d_6r, ~] = pwelch(sr_6r(:, 1), win, [], [], Fs);
[px_d_60, ~] = pwelch(sr_60(:, 1), win, [], [], Fs);
figure;
hold on;
plot(f, sqrt(px_d_of), 'DisplayName', 'OFF');
plot(f, sqrt(px_d_on), 'DisplayName', 'ON');
plot(f, sqrt(px_d_6r), 'DisplayName', '6rpm');
plot(f, sqrt(px_d_60), 'DisplayName', '60rpm');
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, 5000]);
% Frequency Domain - Slip-Ring Signal
[px_sr_of, f] = pwelch(sr_of(:, 2), win, [], [], Fs);
[px_sr_on, ~] = pwelch(sr_on(:, 2), win, [], [], Fs);
[px_sr_6r, ~] = pwelch(sr_6r(:, 2), win, [], [], Fs);
[px_sr_60, ~] = pwelch(sr_60(:, 2), win, [], [], Fs);
figure;
hold on;
plot(f, sqrt(px_sr_of), 'DisplayName', 'OFF');
plot(f, sqrt(px_sr_on), 'DisplayName', 'ON');
plot(f, sqrt(px_sr_6r), 'DisplayName', '6rpm');
plot(f, sqrt(px_sr_60), 'DisplayName', '60rpm');
plot(f, sqrt(px_d_of), '-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, 5000]);