2.0 KiB
2.0 KiB
Cercalo Test Bench
Identification of the Plant
fs = 1e4;
Ts = 1/fs;
We generate white noise with the "random number" simulink block, and we filter that noise.
Gi = (1)/(1+s/2/pi/100);
c2d(Gi, Ts, 'tustin')
c2d(Gi, Ts, 'tustin') ans = 0.030459 (z+1) -------------- (z-0.9391) Sample time: 0.0001 seconds Discrete-time zero/pole/gain model.
load('mat/data_001.mat', 't', 'ux')
figure; plot(t, ux)
[tf_est, freqs] = tfestimate(ux, yx, hanning(ceil(length(ux)/10)), [], [], fs);
% h = idfrd(tf_est, freqs*2*pi, Ts);
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(freqs, abs(tf_est),'--')
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Amplitude [m/N]');
hold off;
ax2 = subplot(2, 1, 2);
hold on;
plot(freqs, mod(180+180/pi*phase(tf_est), 360)-180,'--')
set(gca,'xscale','log');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
xlabel('Frequency [$Hz$]'); ylabel('Phase [deg]');
hold off;