1

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

KharoBangdo
  • 428
  • 1
  • 4
  • 17
Lakshmi
  • 135
  • 1
  • 2
  • 7
  • 1
    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. – jojeck Aug 03 '14 at 11:37

1 Answers1

-2

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
    Actually it is an FIR filter not an IIR,which means the filter coeffs are the filter impulse responce.Thanks though. – Lakshmi Aug 04 '14 at 13:42
  • 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. – Seetha Rama Raju Sanapala Aug 04 '14 at 23:30