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;
A = load('PvaluesAtReceiver.txt');
f = A(:,1);
Preal = A(:,2);
Pimag = A(:,3);
Prealpad = cat(1,Preal,zeros(48000-180,1));
Pimagpad = cat(1,Pimag,zeros(48000-180,1));
fpad = cat(1,f,zeros(48000-180,1));
enter preformatted text here
j = sqrt(-1);

Prealf = Prealpad(88:177);
Pimagf = Pimagpad(88:177);
ff = fpad(88:177);
Prealfpad = cat(1,Prealf,zeros(48000-90,1));
Pimagfpad = cat(1,Pimagf,zeros(48000-90,1));
ffpad = cat(1,ff,zeros(48000-90,1));
X_ff = Prealfpad + j*Pimagfpad;
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:

enter image description here

Does anyone know why this doesn't tend to zero??

enter image description here

This is the frequency domain i want to transform.

  • $\begingroup$ Please plot also the magnitude frequency response. $\endgroup$ May 10 '19 at 9:50
  • $\begingroup$ Looks like your data is very noisy. You also do a lot of padding/resizing etc. which is hard to follow. Please add some comments to your code. $\endgroup$
    – Hilmar
    May 10 '19 at 14:20
  • $\begingroup$ @Hilmar Thank you for your reply. I have posted the updated commented script below as an asnwer. $\endgroup$ May 12 '19 at 13:54
  • $\begingroup$ @OlliNiemitalo The frequency response, with Magnitude on the y-axis and frequency on the x-axis is posted below also $\endgroup$ 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;
A = load('PvaluesAtReceiver.txt');

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

Prealfpad = cat(1,Prealf,zeros(48000-90,1)); %Add zeros to increase time resolution
Pimagfpad = cat(1,Pimagf,zeros(48000-90,1)); %Add zeros to increase time resolution
ffpad = cat(1,ff,zeros(48000-90,1)); %Add zeros to increase time resolution

X_ff = Prealfpad + j*Pimagfpad;

IRf = ifftshift(X_ff); % Rearranges zero-frequency-shifted Fourier transform back to the original transform output

x_tf = ifft(IRf); %Inverse discrete Fourier transform
figure,plot(real(x_tf)), title('Impulse response filtered'); %Plot

This is the updated commented script.

  • $\begingroup$ I suggest starting slow by making sure each part of your script does what you want it to: 1) Start by simply taking the IFFT of the coefficients (Real + 1j*Imag). That should give you a direct representation in the time domain of what you are looking at. 2) Make sure your 125 Hz filtering works before applying it to a huge 48000 length signal. $\endgroup$
    – jeremy
    May 13 '19 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.