67 lines
1.8 KiB
Matlab
67 lines
1.8 KiB
Matlab
% 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.
|
|
|
|
meas14 = load('mat/data_014.mat', 'data'); meas14 = meas14.data;
|
|
meas15 = load('mat/data_015.mat', 'data'); meas15 = meas15.data;
|
|
|
|
% Time Domain
|
|
% The signals are shown on figure [[fig:ac_dc_option_time]].
|
|
|
|
figure;
|
|
hold on;
|
|
plot(meas14(:, 3), meas14(:, 1), 'DisplayName', 'Amp1 - AC');
|
|
plot(meas14(:, 3), meas14(:, 2), 'DisplayName', 'Amp2 - DC');
|
|
plot(meas15(:, 3), meas15(:, 1), 'DisplayName', 'Amp1 - DC');
|
|
plot(meas15(:, 3), meas15(:, 2), 'DisplayName', 'Amp2 - AC');
|
|
hold off;
|
|
legend('Location', 'bestoutside');
|
|
xlabel('Time [s]');
|
|
ylabel('Voltage [V]');
|
|
xlim([0, 100]);
|
|
|
|
% Frequency Domain
|
|
% We first compute some parameters that will be used for the PSD computation.
|
|
|
|
dt = meas14(2, 3)-meas14(1, 3);
|
|
|
|
Fs = 1/dt; % [Hz]
|
|
|
|
win = hanning(ceil(10*Fs));
|
|
|
|
|
|
|
|
% Then we compute the Power Spectral Density using =pwelch= function.
|
|
|
|
[pxamp1ac, f] = pwelch(meas14(:, 1), win, [], [], Fs);
|
|
[pxamp2dc, ~] = pwelch(meas14(:, 2), win, [], [], Fs);
|
|
|
|
[pxamp1dc, ~] = pwelch(meas15(:, 1), win, [], [], Fs);
|
|
[pxamp2ac, ~] = pwelch(meas15(:, 2), win, [], [], Fs);
|
|
|
|
|
|
|
|
% The ASD of the signals are compare on figure [[fig:ac_dc_option_asd]].
|
|
|
|
figure;
|
|
hold on;
|
|
plot(f, sqrt(pxamp1ac), 'DisplayName', 'Amp1 - AC');
|
|
plot(f, sqrt(pxamp2dc), 'DisplayName', 'Amp2 - DC');
|
|
plot(f, sqrt(pxamp1dc), 'DisplayName', 'Amp1 - DC');
|
|
plot(f, sqrt(pxamp2ac), 'DisplayName', 'Amp2 - AC');
|
|
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]);
|