I have designed my filter using firhalfband(N,Fo,A), which gives me the filter coefficients. Then I try to see the frequency response of it. I use these two function: fft, and freqz, but they are giving me different result in my figure, why is that? I wonder how these two MATLAB functions operate when taking the frequency response of a signal. I am expecting them to be the same.

Thank you

  • 1
    $\begingroup$ There is no need to duplicate posts on the same topic. Here is answer that should help you. Basically output from the fft must be scaled and represented properly. $\endgroup$ – jojek Aug 3 '14 at 11:37

If you have the filter coefficients, freqz is the way to go - the various optional input arguments and the expected outputs are documented in MATLAB which you can see using help freqz. Snippets given below:

" freqz Digital filter frequency response. [H,W] = freqz(B,A,N) returns the N-point complex frequency response vector H and the N-point frequency vector W in radians/sample of the filter:

[H,F] = freqz(B,A,N,Fs) and [H,F] = freqz(B,A,N,'whole',Fs) return frequency vector F (in Hz), where Fs is the sampling frequency (in Hz). "

If you have filter's impulse response - which will be different from the filter coefficients - you can use it to find the frequency response of the filter using the FFT.

  • 1
    $\begingroup$ Actually it is an FIR filter not an IIR,which means the filter coeffs are the filter impulse responce.Thanks though. $\endgroup$ – Lakshmi Aug 4 '14 at 13:42
  • $\begingroup$ Then it should match with the result through the FFT if you apply it and interpret it properly, I thought you were talking about a general filter which has both FIR and IIR components. Thanks though for understanding what I meant. $\endgroup$ – Seetha Rama Raju Sanapala Aug 4 '14 at 23:30

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.