fft of impulse response does not equal bode of transfer function
Show older comments
Hello
I am struggling with the problem, that the fourier transform of the impulse response of my system does not equal the bode plot of my transfer function. It would be great if somebody could help me to find the misstake.
clear all, clc, close all
%.........
% System
%.........
s=tf('s');
stoerung_G = 75 / (s + 25);
figure; bode(stoerung_G); grid;
stoerund_dt = 0.00001;
stoerung_t = [0 : stoerund_dt : 0.4]';
[stoerung_impulse] = impulse(stoerung_G, stoerung_t);
%.........
% Fourieranalyse
%.........
stoerung_y = stoerung_impulse;
stoerung_Fs = 1/stoerund_dt; % Hz
stoerung_L = size(stoerung_y,1);
stoerung_Y_ft = fft(stoerung_y);
P2 = abs(stoerung_Y_ft/stoerung_L);
P1 = P2(1:stoerung_L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
P1_log = 20 * log10(P1);
Phase2 = angle(stoerung_Y_ft);
Phase1 = Phase2(1:stoerung_L/2+1);
Phase1(2:end-1) = 2*Phase1(2:end-1);
Phase1 = Phase1*180/pi();
stoerung_f = stoerung_Fs*(0:(stoerung_L/2))/stoerung_L;
stoerung_w = 2*pi()*stoerung_f;
figure
subplot(211)
semilogx(stoerung_w,P1_log), grid, xlim([1 3000]);
title('Single-Sided Amplitude Spectrum of X(t)')
xlabel('w (rad/s)')
ylabel('|Mag| (dB)')
subplot(212)
semilogx(stoerung_w,Phase1), grid, xlim([1 3000]);
xlabel('w (rad/s)')
ylabel('Phase (degree)')
Accepted Answer
More Answers (1)
Dimitris Kalogiros
on 11 Sep 2018
You have to change the time interval that you used to define stoerung_t
Try a larger one:
stoerung_t = [0 : stoerund_dt : 40-stoerund_dt]';
Now, two bode diagrams will become identical
2 Comments
Lukas
on 18 Sep 2018
Dimitris Kalogiros
on 18 Sep 2018
These artifacts stems from the fact that you compare a continous time system, discribed by laplace transform (stoerung_G), and a discrete time system, described by z-transform (stoerung_Y_ft).
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
