2021-06-08 17:31:16 +02:00
|
|
|
%% Clear Workspace and Close figures
|
|
|
|
clear; close all; clc;
|
|
|
|
|
|
|
|
%% Intialize Laplace variable
|
|
|
|
s = zpk('s');
|
|
|
|
|
|
|
|
addpath('./src/');
|
|
|
|
|
|
|
|
% Test with one APA
|
|
|
|
|
|
|
|
%% Load measurement data for APA number 1
|
2021-06-08 17:37:28 +02:00
|
|
|
meas_data_lf = {};
|
2021-06-08 17:31:16 +02:00
|
|
|
for i = 1:6
|
2021-06-08 17:37:28 +02:00
|
|
|
meas_data_lf(i) = {load(sprintf('mat/frf_data_exc_strut_%i_noise_lf.mat', i), 't', 'Va', 'Vs', 'de')};
|
|
|
|
meas_data_hf(i) = {load(sprintf('mat/frf_data_exc_strut_%i_noise_hf.mat', i), 't', 'Va', 'Vs', 'de')};
|
2021-06-08 17:31:16 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
%%
|
2021-06-08 17:37:28 +02:00
|
|
|
Ts = (meas_data_lf{1}.t(end) - (meas_data_lf{1}.t(1)))/(length(meas_data_lf{1}.t)-1);
|
2021-06-08 17:31:16 +02:00
|
|
|
Fs = 1/Ts;
|
|
|
|
|
|
|
|
win = hanning(ceil(1*Fs)); % Hannning Windows
|
|
|
|
|
|
|
|
%% DVF
|
2021-06-08 17:37:28 +02:00
|
|
|
[~, f] = tfestimate(meas_data_lf{1}.Va, meas_data_lf{1}.de, win, [], [], 1/Ts);
|
2021-06-08 17:31:16 +02:00
|
|
|
|
2021-06-08 17:37:28 +02:00
|
|
|
G_dvf_lf = zeros(length(f), 6, 6);
|
|
|
|
G_dvf_hf = zeros(length(f), 6, 6);
|
2021-06-08 17:31:16 +02:00
|
|
|
for i = 1:6
|
2021-06-08 17:37:28 +02:00
|
|
|
G_dvf_lf(:, :, i) = tfestimate(meas_data_lf{i}.Va, meas_data_lf{i}.de, win, [], [], 1/Ts);
|
|
|
|
G_dvf_hf(:, :, i) = tfestimate(meas_data_hf{i}.Va, meas_data_hf{i}.de, win, [], [], 1/Ts);
|
2021-06-08 17:31:16 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
%% IFF
|
2021-06-08 17:37:28 +02:00
|
|
|
[~, f] = tfestimate(meas_data_lf{1}.Va, meas_data_lf{1}.de, win, [], [], 1/Ts);
|
2021-06-08 17:31:16 +02:00
|
|
|
|
2021-06-08 17:37:28 +02:00
|
|
|
G_iff_lf = zeros(length(f), 6, 6);
|
|
|
|
G_iff_hf = zeros(length(f), 6, 6);
|
2021-06-08 17:31:16 +02:00
|
|
|
for i = 1:6
|
2021-06-08 17:37:28 +02:00
|
|
|
G_iff_lf(:, :, i) = tfestimate(meas_data_lf{i}.Va, meas_data_lf{i}.Vs, win, [], [], 1/Ts);
|
|
|
|
G_iff_hf(:, :, i) = tfestimate(meas_data_hf{i}.Va, meas_data_hf{i}.Vs, win, [], [], 1/Ts);
|
2021-06-08 17:31:16 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
%%
|
2021-06-08 17:37:28 +02:00
|
|
|
i_lf = f < 250;
|
|
|
|
i_hf = f > 250;
|
|
|
|
|
2021-06-08 17:31:16 +02:00
|
|
|
figure;
|
|
|
|
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
|
|
|
|
|
|
|
|
ax1 = nexttile([2,1]);
|
|
|
|
hold on;
|
|
|
|
for i =1:6
|
2021-06-08 17:37:28 +02:00
|
|
|
set(gca,'ColorOrderIndex',i)
|
|
|
|
plot(f(i_lf), abs(G_dvf_lf(i_lf,i, i)));
|
|
|
|
set(gca,'ColorOrderIndex',i)
|
|
|
|
plot(f(i_hf), abs(G_dvf_hf(i_hf,i, i)));
|
2021-06-08 17:31:16 +02:00
|
|
|
end
|
|
|
|
hold off;
|
|
|
|
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
|
|
|
|
ylabel('Amplitude $V_{out}/V_{in}$ [V/V]'); set(gca, 'XTickLabel',[]);
|
|
|
|
hold off;
|
|
|
|
|
|
|
|
ax2 = nexttile;
|
|
|
|
hold on;
|
|
|
|
for i =1:6
|
2021-06-08 17:37:28 +02:00
|
|
|
set(gca,'ColorOrderIndex',i)
|
|
|
|
plot(f(i_lf), 180/pi*angle(G_dvf_lf(i_lf,i, i)));
|
|
|
|
set(gca,'ColorOrderIndex',i)
|
|
|
|
plot(f(i_hf), 180/pi*angle(G_dvf_hf(i_hf,i, i)));
|
2021-06-08 17:31:16 +02:00
|
|
|
end
|
|
|
|
hold off;
|
|
|
|
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
|
|
|
|
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
|
|
|
hold off;
|
|
|
|
yticks(-360:90:360);
|
|
|
|
|
|
|
|
linkaxes([ax1,ax2],'x');
|
2021-06-08 17:37:28 +02:00
|
|
|
xlim([20, 2e3]);
|
2021-06-08 17:31:16 +02:00
|
|
|
|
|
|
|
%%
|
|
|
|
figure;
|
|
|
|
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
|
|
|
|
|
|
|
|
ax1 = nexttile([2,1]);
|
|
|
|
hold on;
|
|
|
|
for i =1:6
|
2021-06-08 17:37:28 +02:00
|
|
|
set(gca,'ColorOrderIndex',i)
|
|
|
|
plot(f(i_lf), abs(G_iff_lf(i_lf,i, i)));
|
|
|
|
set(gca,'ColorOrderIndex',i)
|
|
|
|
plot(f(i_hf), abs(G_iff_hf(i_hf,i, i)));
|
2021-06-08 17:31:16 +02:00
|
|
|
end
|
|
|
|
hold off;
|
|
|
|
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
|
|
|
|
ylabel('Amplitude $V_{out}/V_{in}$ [V/V]'); set(gca, 'XTickLabel',[]);
|
|
|
|
hold off;
|
|
|
|
|
|
|
|
ax2 = nexttile;
|
|
|
|
hold on;
|
|
|
|
for i =1:6
|
2021-06-08 17:37:28 +02:00
|
|
|
set(gca,'ColorOrderIndex',i)
|
|
|
|
plot(f(i_lf), 180/pi*angle(G_iff_lf(i_lf,i, i)));
|
|
|
|
set(gca,'ColorOrderIndex',i)
|
|
|
|
plot(f(i_hf), 180/pi*angle(G_iff_hf(i_hf,i, i)));
|
2021-06-08 17:31:16 +02:00
|
|
|
end
|
|
|
|
hold off;
|
|
|
|
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
|
|
|
|
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
|
|
|
hold off;
|
|
|
|
yticks(-360:90:360);
|
|
|
|
|
|
|
|
linkaxes([ax1,ax2],'x');
|
2021-06-08 17:37:28 +02:00
|
|
|
xlim([20, 2e3]);
|