# Use of FFT to compute frequency response [duplicate]

Is there an algo that uses fft to compute the frequency response of an FIR?

Currently I follow the textbook method of evaluating the $z$ transform at $e^{-j\omega}$ for $\omega$ running from $0$ to $\pi$, but this is a numerically intense process.

If such a method does exist, can it also be used to compute the gradient of the frequency response? (for use in cost functions)

## marked as duplicate by jojek♦, MBaz, Peter K.♦Oct 14 '15 at 11:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• @jojek I don't believe it's an exact duplicate. The OP suggests they are already doing that, but want it to be faster by using an FFT-based approach. – Peter K. Oct 11 '15 at 20:32
• Indeed. The last part of my answer tackles that. – jojek Oct 11 '15 at 20:33
• OK. I propose modifying the other question to incorporate that detail, and then closing this question. – Peter K. Oct 14 '15 at 11:44

## 1 Answer

To compute the freq response of a tapped-delay line FIR filter, zero-pad your filter's coefficients with a string of zero-valued samples so that the new sequence is N samples in length (N must be an integer power of two). Then perform an N-point FFT on the zero-padded sequence. The FFT results will be your desired freq response. The larger N, the finer will be the frequency granularity of your freq response results.