2021-06-07 19:00:29 +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 16:51:38 +02:00
|
|
|
strut_number = 1;
|
|
|
|
% load(sprintf('mat/frf_data_exc_strut_%i_noise_lf.mat', strut_number), 't', 'Va', 'Vs', 'de');
|
|
|
|
load(sprintf('mat/frf_data_exc_strut_%i_noise_hf.mat', strut_number), 't', 'Va', 'Vs', 'de');
|
2021-06-07 19:00:29 +02:00
|
|
|
|
|
|
|
% Compute transfer functions:
|
|
|
|
|
|
|
|
Ts = (t(end) - t(1))/(length(t)-1);
|
|
|
|
Fs = 1/Ts;
|
|
|
|
|
|
|
|
win = hanning(ceil(1*Fs)); % Hannning Windows
|
|
|
|
|
2021-06-08 16:51:38 +02:00
|
|
|
%% DVF
|
2021-06-07 19:00:29 +02:00
|
|
|
[G_dvf, f] = tfestimate(Va, de, win, [], [], 1/Ts);
|
|
|
|
|
|
|
|
figure;
|
2021-06-08 16:51:38 +02:00
|
|
|
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
|
2021-06-07 19:00:29 +02:00
|
|
|
|
2021-06-08 16:51:38 +02:00
|
|
|
ax1 = nexttile([2,1]);
|
2021-06-07 19:00:29 +02:00
|
|
|
hold on;
|
2021-06-08 16:51:38 +02:00
|
|
|
for i =1:6
|
|
|
|
plot(f, abs(G_dvf(:,i)));
|
|
|
|
end
|
2021-06-07 19:00:29 +02:00
|
|
|
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;
|
2021-06-08 16:51:38 +02:00
|
|
|
for i =1:6
|
|
|
|
plot(f, 180/pi*angle(G_dvf(:,i)));
|
|
|
|
end
|
2021-06-07 19:00:29 +02:00
|
|
|
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');
|
|
|
|
xlim([5, 5e3]);
|
|
|
|
|
2021-06-08 16:51:38 +02:00
|
|
|
%% IFF
|
|
|
|
[G_iff, f] = tfestimate(Va, Vs, win, [], [], 1/Ts);
|
|
|
|
|
2021-06-07 19:00:29 +02:00
|
|
|
figure;
|
2021-06-08 16:51:38 +02:00
|
|
|
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
|
2021-06-07 19:00:29 +02:00
|
|
|
|
2021-06-08 16:51:38 +02:00
|
|
|
ax1 = nexttile([2,1]);
|
|
|
|
hold on;
|
|
|
|
for i =1:6
|
|
|
|
plot(f, abs(G_iff(:,i)));
|
|
|
|
end
|
|
|
|
hold off;
|
2021-06-07 19:00:29 +02:00
|
|
|
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
|
|
|
|
ylabel('Amplitude $V_{out}/V_{in}$ [V/V]'); set(gca, 'XTickLabel',[]);
|
|
|
|
hold off;
|
|
|
|
|
|
|
|
ax2 = nexttile;
|
2021-06-08 16:51:38 +02:00
|
|
|
hold on;
|
|
|
|
for i =1:6
|
|
|
|
plot(f, 180/pi*angle(G_iff(:,i)));
|
|
|
|
end
|
|
|
|
hold off;
|
2021-06-07 19:00:29 +02:00
|
|
|
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 16:51:38 +02:00
|
|
|
xlim([5, 5e3]);
|
2021-06-07 19:00:29 +02:00
|
|
|
|
2021-06-08 16:51:38 +02:00
|
|
|
%%
|
|
|
|
[coh_dvf, ~] = mscohere(Va, de, win, [], [], 1/Ts);
|
|
|
|
[coh_iff, ~] = mscohere(Va, Vs, win, [], [], 1/Ts);
|
2021-06-07 19:00:29 +02:00
|
|
|
|
2021-06-08 16:51:38 +02:00
|
|
|
%%
|
|
|
|
figure;
|
|
|
|
hold on;
|
|
|
|
for i =1:6
|
|
|
|
plot(f, coh_dvf(:,i));
|
2021-06-07 19:00:29 +02:00
|
|
|
end
|
2021-06-08 16:51:38 +02:00
|
|
|
hold off;
|
|
|
|
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
|
|
|
|
xlabel('Frequency [Hz]'); ylabel('Coherence');
|
|
|
|
ylim([0,1]);
|
|
|
|
|
|
|
|
%%
|
|
|
|
figure;
|
|
|
|
hold on;
|
|
|
|
for i =1:6
|
|
|
|
plot(f, coh_iff(:,i));
|
|
|
|
end
|
|
|
|
hold off;
|
|
|
|
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
|
|
|
|
xlabel('Frequency [Hz]'); ylabel('Coherence');
|
|
|
|
ylim([0,1]);
|