# My impulse response does not tend to zero

I am doing an IFFT of frequency response data achieved with Simulation tools.

When I plot my impulse response it looks wrong as the response does not tend to zero as it should. Instead there seems to be a rise in pressure towards the end of the signal.

My script looks like this:

close all;
clear all;
f = A(:,1);
Preal = A(:,2);
Pimag = A(:,3);
enter preformatted text here
j = sqrt(-1);

X_ff = [zeros(ff(1),1); X_ff];
IRf = ifftshift(X_ff);
x_tf = ifft(IRf);
figure,plot(real(x_tf)), title('Impulse response filtered');


This produced the following plot: Does anyone know why this doesn't tend to zero?? This is the frequency domain i want to transform.

• Please plot also the magnitude frequency response. May 10 '19 at 9:50
• @Hilmar Thank you for your reply. I have posted the updated commented script below as an asnwer. May 12 '19 at 13:54
• @OlliNiemitalo The frequency response, with Magnitude on the y-axis and frequency on the x-axis is posted below also May 12 '19 at 14:03

Note that the DFT transforms a periodic sequence into a periodic sequence. Hence, the result of your IFFT is intrinsically periodic and you should view it as such. The parts you are seeing at the end of it are thus just as well behind the start as they are before it.

Hence, this part may as well be some form of pre-ringing, stemming from a nonzero group delay of your filter.

Note also that the FFT implicitly periodifies your spectrum. It looks a little cut, so you may be missing some essential parts.

close all;
clear all;

f = A(:,1); %frequencies of data
Preal = A(:,2); %Real part of data
Pimag = A(:,3); %Imaginary part of data

j = sqrt(-1);

Prealf = Preal(88:177); %Filter data for the 125Hz band
Pimagf = Pimag(88:177); %Filter data for the 125Hz band
ff = f(88:177); %Filter data for the 125Hz band