74 lines
1.4 KiB
Mathematica
74 lines
1.4 KiB
Mathematica
|
%% Clear Workspace and Close figures
|
||
|
clear; close all; clc;
|
||
|
|
||
|
%% Intialize Laplace variable
|
||
|
s = zpk('s');
|
||
|
|
||
|
addpath('./mat/');
|
||
|
|
||
|
% Aluminium Tube and Bubble Sheet
|
||
|
|
||
|
load('short_test_plastic.mat');
|
||
|
Ts = 1e-4; % [s]
|
||
|
|
||
|
x = detrend(x, 0);
|
||
|
|
||
|
figure;
|
||
|
plot(t, 1e9*x)
|
||
|
xlabel('Time [s]'); ylabel('Displacement [nm]');
|
||
|
|
||
|
win = hann(ceil(length(x)/10));
|
||
|
[p_1, f_1] = pwelch(x, win, [], [], 1/Ts);
|
||
|
|
||
|
% Only Aluminium Tube
|
||
|
|
||
|
load('short_test_alu_tube.mat');
|
||
|
Ts = 1e-4; % [s]
|
||
|
|
||
|
x = detrend(x, 0);
|
||
|
|
||
|
|
||
|
|
||
|
% The time domain measurement is shown in Figure [[fig:short_meas_time_domain]].
|
||
|
|
||
|
figure;
|
||
|
plot(t, 1e9*x)
|
||
|
xlabel('Time [s]'); ylabel('Displacement [nm]');
|
||
|
|
||
|
win = hann(ceil(length(x)/10));
|
||
|
[p_2, f_2] = pwelch(x, win, [], [], 1/Ts);
|
||
|
|
||
|
% Nothing
|
||
|
|
||
|
load('short_test_without_material.mat');
|
||
|
Ts = 1e-4; % [s]
|
||
|
|
||
|
x = detrend(x, 0);
|
||
|
|
||
|
|
||
|
|
||
|
% The time domain measurement is shown in Figure [[fig:short_meas_time_domain]].
|
||
|
|
||
|
figure;
|
||
|
plot(t, 1e9*x)
|
||
|
xlabel('Time [s]'); ylabel('Displacement [nm]');
|
||
|
|
||
|
win = hann(ceil(length(x)/10));
|
||
|
[p_3, f_3] = pwelch(x, win, [], [], 1/Ts);
|
||
|
|
||
|
% Comparison
|
||
|
|
||
|
figure;
|
||
|
hold on;
|
||
|
plot(f_1(8:end), sqrt(p_1(8:end)), '-', ...
|
||
|
'DisplayName', 'Alunimium + Bubble');
|
||
|
plot(f_2(8:end), sqrt(p_2(8:end)), '-', ...
|
||
|
'DisplayName', 'Aluminium');
|
||
|
plot(f_3(8:end), sqrt(p_3(8:end)), '-', ...
|
||
|
'DisplayName', 'nothing');
|
||
|
hold off;
|
||
|
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
|
||
|
ylabel('ASD [$m/\sqrt{Hz}$]'); xlabel('Frequency [Hz]');
|
||
|
xlim([1e-1, 5e3]);
|
||
|
legend('location', 'northeast');
|