# Numerical Calculation of impulse response out of frequency response

Currently I work on my Masterthesis which deals with structural dynamic simulation. As a part of it I have to filter a Signal with a FIR-Filter. From that Filter I know the Frequency Response (picture).

The code is written in Python and I'm not sure how to apply the IFFT since I have just a real input.

In python there is function called irfft which stands for inverse real fft. So a ifft for real input. But it seems that something goes wrong with the time signal. I'm aware of that I have no phase in this case. But I guess for Filters in Signal processing it is pretty common to just have the frequency response and calculate the impulse response out of it? So there should be a right way to do it... Unfortunately I'm no expert in Signal processing and at the moment I'm pretty much stuck at this problem.

UPDATE: I think the correct way is to add just zero phase (so +0j) to the frequency response. For the ifft the first bin has to be 0 valued, from 1 - N/2 i add my frequencies as I have it from the response, and from N/2 - N I add the conjugate complex numbers (as the phase is zero the values are just in descending order). Hope this will do the trick.

• you don't have enough information to calculate an impulse response if you don't have the phase of the frequency response. there are some things you can do to infer the phase response, but the best is to measure it when the amplitude response is measured. Jan 16, 2019 at 20:03

I would suggest the frequency sampling design method, which results in a linear phase FIR filter. You sample the desired magnitude on an equidistant grid, add a linear phase term, and then you compute the impulse response by taking an inverse DFT. The resulting impulse response is usually windowed. I've explained the details in this answer, which also includes some Matlab/Octave code. Note that windowing is not done in that simple code fragment.

• @Michael: You're welcome :) Jan 18, 2019 at 8:37