I want to see the frequency response of 1024 order bandpass filter in MATLAB.

The sampling frequency is 16kHz and the pass band frequency is [376Hz 480Hz]. I have implemented the bandpass filter using inbuilt function fir1 as b1 = fir1(1024,[376/8000 480/8000],'bandpass').
To plot the frequency response of the filter, I have used the inbuilt function freqz(b1,1,10000,16000).

My doubt is -3dB frequency obtained from the MATLAB plot should be at the pass band cut off frequency i.e at 376Hz and 480Hz right?enter image description here

Now I tried to plot the magnitude response using fdatool in MATLAB, by providing the following details: FIR equiripple filter was selected order=1024 Fs=16000 Fstop1=256 Fpass1=376 Fpass2=480 Fstop2=600 Wstop1=1 Wpass=1 Wstop2=1 and the plot obtained was as below:

enter image description here

There is difference in the frequency response

  • $\begingroup$ You edited your question as I was answering. Originally, you were using a order N = 128 FIR filter and wondering why the cut-off was not at -6dB. Seems you've figured out you needed to increase the order to get the desired result. Hopefully my answer still explains why ;) $\endgroup$
    – Jdip
    Oct 10, 2022 at 7:00
  • $\begingroup$ Why is the frequency response obtained using Matlab fdatool showing normalized gain of 0dB at passband cut off frequencies $\endgroup$
    – Deepa
    Oct 10, 2022 at 8:55
  • 1
    $\begingroup$ You're using an equiripple design. That's a different method. Change to window method and you'll get your -6dB back if you feel like it ;) $\endgroup$
    – Jdip
    Oct 10, 2022 at 16:12

1 Answer 1


fir1 designs FIR filters using the window method. Per the documentation:

The cutoff frequency is the frequency at which the normalized gain of the filter is –6 dB.

However, for the cut-off you specify to be at -6dB, you need to have appropriate transition bandwidth. I'm assuming you know what the window method for designing FIR filters is. If you don't, I suggest you study some examples.

Long story short, the transition bandwidth is related to the design window's main-lobe width, which is itself related to the design window's length.
For example, fir1 uses a hamming window by default, which has main lobe width of $8\pi/M$, $M$ being the length of the window.

The smaller $M$ is, the larger your transition bandwidth is.
As a matter of fact, you can estimate that the first side lobes on either part of the main lobe will have peaks at approximately $\omega_l - 1/2 \cdot8\pi/ M$ and $\omega_h + 1/2 \cdot8\pi/ M$, $\omega_l$ and $\omega_h$ being the cut-off frequencies for your band-pass. (Note: $\pi$ is the normalized nyquist frequency, so replace with $f_s/2 = 8000$ in your case)

Here are a few examples using your specs. Notice with $M$ increasing, the transition band sharpens, and you get closer to that $-6$dB at $376\, Hz$ and $480 \, Hz$ you're looking for.

enter image description here

  • 1
    $\begingroup$ @Deepa did jdip answer your question to your satisfaction? $\endgroup$ Dec 9, 2022 at 15:04
  • 1
    $\begingroup$ @DanBoschen won't notify if the user hasn't commented on the post itself $\endgroup$ Dec 10, 2022 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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