test-bench-piezo-amplifiers/comp_pi_cedrat.m
2020-08-12 17:53:51 +02:00

34 lines
929 B
Matlab

ce_results = load('mat/cedrat_la75b_high_1_stack.mat', 't', 'V_in', 'V_out');
pi_results = load('mat/pi_505_high.mat', 't', 'V_in', 'V_out');
%%
run setup;
win = hann(ceil(0.1/Ts));
[tf_ce, f_ce] = tfestimate(ce_results.V_in, ce_results.V_out, win, [], [], 1/Ts);
[tf_pi, f_pi] = tfestimate(pi_results.V_in, pi_results.V_out, win, [], [], 1/Ts);
%%
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(f_pi, abs(tf_pi), 'DisplayName', 'PI')
plot(f_ce, abs(tf_ce), 'DisplayName', 'Cedrat')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
ylabel('Amplitude'); xlabel('Frequency [Hz]');
hold off;
legend('location', 'southwest');
ylim([0.1, 50]);
ax2 = subplot(2, 1, 2);
hold on;
plot(f_pi, 180/pi*unwrap(angle(tf_pi)))
plot(f_ce, 180/pi*unwrap(angle(tf_ce)))
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Phase'); xlabel('Frequency [Hz]');
hold off;
ylim([-360, 0]);
linkaxes([ax1,ax2], 'x');
xlim([10, 5000]);