% Matlab Init :noexport:ignore: clear; close all; clc; %% Intialize Laplace variable s = zpk('s'); %% Initialize ans with org-babel ans = 0; % Load data % We load the data of the z axis of two geophones. sr_off = load('mat/data_001.mat', 't', 'x1', 'x2'); sr_on = load('mat/data_002.mat', 't', 'x1', 'x2'); % Analysis % Let's first look at the signal produced by the DAC (figure [[fig:random_signal]]). figure; hold on; plot(sr_on.t, sr_on.x1); hold off; xlabel('Time [s]'); ylabel('Voltage [V]'); xlim([0 10]); % #+NAME: fig:random_signal % #+CAPTION: Random signal produced by the DAC % #+RESULTS: fig:random_signal % [[file:figs/random_signal.png]] % We now look at the difference between the signal directly measured by the ADC and the signal that goes through the slip-ring (figure [[fig:slipring_comp_signals]]). figure; hold on; plot(sr_on.t, sr_on.x1 - sr_on.x2, 'DisplayName', 'Slip-Ring - $\omega = 1rpm$'); plot(sr_off.t, sr_off.x1 - sr_off.x2,'DisplayName', 'Slip-Ring off'); hold off; xlabel('Time [s]'); ylabel('Voltage [V]'); xlim([0 10]); legend('Location', 'northeast'); % #+NAME: fig:slipring_comp_signals % #+CAPTION: Alteration of the signal when the slip-ring is turning % #+RESULTS: fig:slipring_comp_signals % [[file:figs/slipring_comp_signals.png]] dt = sr_on.t(2) - sr_on.t(1); Fs = 1/dt; % [Hz] win = hanning(ceil(1*Fs)); [pxx_on, f] = pwelch(sr_on.x1 - sr_on.x2, win, [], [], Fs); [pxx_off, ~] = pwelch(sr_off.x1 - sr_off.x2, win, [], [], Fs); figure; hold on; plot(f, sqrt(pxx_on), 'DisplayName', 'Slip-Ring - $\omega = 1rpm$'); plot(f, sqrt(pxx_off),'DisplayName', 'Slip-Ring off'); hold off; set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log'); xlabel('Frequency [Hz]'); ylabel('PSD $\left[\frac{V}{\sqrt{Hz}}\right]$'); legend('Location', 'northeast'); xlim([1, 500]); ylim([1e-5, 1e-3])