66 lines
2.6 KiB
Mathematica
66 lines
2.6 KiB
Mathematica
|
%% Clear Workspace and Close figures
|
||
|
clear; close all; clc;
|
||
|
|
||
|
%% Intialize Laplace variable
|
||
|
s = zpk('s');
|
||
|
|
||
|
%% Path for functions, data and scripts
|
||
|
addpath('./mat/'); % Path for data
|
||
|
addpath('./src/'); % Path for functions
|
||
|
|
||
|
%% Colors for the figures
|
||
|
colors = colororder;
|
||
|
|
||
|
% Without Encoder
|
||
|
% When the encoder is not fixed to the strut, the obtained FRF are shown in Figure ref:fig:test_struts_spur_res_frf.
|
||
|
|
||
|
|
||
|
%% Load Data (without the encoder)
|
||
|
bending_X = load('strut_spur_res_x_bending.mat');
|
||
|
bending_Y = load('strut_spur_res_y_bending.mat');
|
||
|
torsion_Z = load('strut_spur_res_z_torsion.mat');
|
||
|
|
||
|
%% Plot the responses (without the encoder)
|
||
|
figure;
|
||
|
hold on;
|
||
|
plot(bending_X.FFT1_AvSpc_1_RMS_X_Val, bending_X.FFT1_AvSpc_1_RMS_Y_Val, ...
|
||
|
'DisplayName', 'X-Bending')
|
||
|
plot(bending_Y.FFT1_AvSpc_1_RMS_X_Val, bending_Y.FFT1_AvSpc_1_RMS_Y_Val, ...
|
||
|
'DisplayName', 'Y-Bending')
|
||
|
plot(torsion_Z.FFT1_AvSpc_1_RMS_X_Val, torsion_Z.FFT1_AvSpc_1_RMS_Y_Val, ...
|
||
|
'DisplayName', 'Z-torsion');
|
||
|
text(226, 1.5e-4,{'226Hz'}, 'VerticalAlignment', 'bottom','HorizontalAlignment','center')
|
||
|
text(337, 6e-5,{'337Hz'}, 'VerticalAlignment', 'bottom','HorizontalAlignment','center')
|
||
|
text(398, 1.5e-4,{'398Hz'}, 'VerticalAlignment', 'bottom','HorizontalAlignment','center')
|
||
|
hold off;
|
||
|
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
|
||
|
xlabel('Frequency [Hz]'); ylabel('Amplitude');
|
||
|
xlim([50, 8e2]); ylim([5e-7, 3e-4])
|
||
|
legend('location', 'northwest');
|
||
|
|
||
|
% With Encoder
|
||
|
% Then, one encoder is fixed to the strut and the FRF are measured again and shown in Figure ref:fig:test_struts_spur_res_frf_enc.
|
||
|
|
||
|
%% Load Data (with the encoder)
|
||
|
bending_X_enc = load('strut_spur_res_x_bending_enc.mat');
|
||
|
bending_Y_enc = load('strut_spur_res_y_bending_enc.mat');
|
||
|
torsion_Z_enc = load('strut_spur_res_z_torsion_enc.mat');
|
||
|
|
||
|
%% Plot the responses (with the encoder)
|
||
|
figure;
|
||
|
hold on;
|
||
|
plot(bending_X_enc.FFT1_AvSpc_1_RMS_X_Val, bending_X_enc.FFT1_AvSpc_1_RMS_Y_Val, ...
|
||
|
'DisplayName', 'X-Bending')
|
||
|
plot(bending_Y_enc.FFT1_AvSpc_1_RMS_X_Val, bending_Y_enc.FFT1_AvSpc_1_RMS_Y_Val, ...
|
||
|
'DisplayName', 'Y-Bending')
|
||
|
plot(torsion_Z_enc.FFT1_AvSpc_1_RMS_X_Val, torsion_Z_enc.FFT1_AvSpc_1_RMS_Y_Val, ...
|
||
|
'DisplayName', 'Z-torsion');
|
||
|
text(198, 4e-5,{'198Hz'}, 'VerticalAlignment', 'bottom','HorizontalAlignment','center')
|
||
|
text(293, 6e-5,{'293Hz'}, 'VerticalAlignment', 'bottom','HorizontalAlignment','center')
|
||
|
text(381, 1e-4,{'381Hz'}, 'VerticalAlignment', 'bottom','HorizontalAlignment','center')
|
||
|
hold off;
|
||
|
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
|
||
|
xlabel('Frequency [Hz]'); ylabel('Amplitude');
|
||
|
xlim([50, 8e2]); ylim([5e-7, 2e-4])
|
||
|
legend('location', 'northwest');
|