phd-test-bench-struts/matlab/test_struts_1_flexible_modes.m

65 lines
2.7 KiB
Matlab

%% 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;
% Measured results
% The obtained frequency response functions for the three configurations (X-bending, Y-bending and Z-torsion) are shown in Figure ref:fig:test_struts_spur_res_frf_no_enc when the encoder is not fixed to the strut and in Figure ref:fig:test_struts_spur_res_frf_enc when the encoder is fixed to the strut.
%% 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');
%% 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 (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(310, 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])
xticks([50, 100, 500]);
legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 1);
%% 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, 3e-4])
xticks([50, 100, 500]);
legend('location', 'southwest', 'FontSize', 8, 'NumColumns', 1);