matlabffttransfer-functionintegrator

Unexpected FFT output of the impulse response of an integrator - MATLAB


I am trying to get the frequency response of any transfer functions using the Fourier transform of the impulse response of the system. It works pretty well for most of the cases tested but I still have a problem with transfer functions in which there is an integrator (e.g. 1/s ; (4s+2)/(3s^2+s) etc.).

Let's take the example of a pure integrator with H(s) = 1/s. The impulse response obtained is a step function as expected but then, the Fourier transform of the impulse response does not give the expected theoretical results. Instead it gives really small results and do not lead to the classic characteristics of an integrator (-20dB/decade magnitude and -90deg phase) after processing.

Maybe a few lines of codes can be helpful if I was not clear enough:

h = tf(1,[1 0]);
t_step = .1;
t = [0 : t_step : 100000]';
[y,t1] = impulse(h,t);
y_fft = fft(y);

Do you know where this problem may come from? If you need further information, please let me know. I am working on MATLAB R2013b.


Solution

  • As mentioned in my comment, the problem is related to:

    1. fft assumes a periodic signal, i.e. an infinite repetition of the provided discrete signal
    2. you should also include the response for negative times, i.e. before the pulse occured.

    h = tf(1,[1 0]);
    t_step = 1;
    t = [0 : t_step : 999]';
    [y,t1] = impulse(h,t);
    
    y = [y; zeros(1000, 1)];
    y_fft = fft(y);
    
    figure
    semilogx(db(y_fft(1:end/2)), 'r.');
    
    figure
    semilogx(180/pi*angle(y_fft(y_fft(1:end/2)~=0)), 'r');
    

    enter image description here enter image description here

    Further remarks