I am aiming to create a digital windowing FIR filter on MATLAB and have been given specs such as a:

  • sampling frequency of 360Hz
  • maximum filter order of 5
  • cut-off frequency of 98Hz/ 1.710rad/sample (normalised)

The cut-off frequency was approximated by doing a DFT on the noisy signal that needs filtering, i have put an image below. I am unsure how to calculate or approximate the stopband cut-off frequency and stopband attenuation and i would really appreciate any advice.

DFT of the noise signal

DFT of the noise signal

DFT of original signal enter image description here

  • $\begingroup$ Maximum order of 5 would be really small (and ineffective) as an FIR filter. The requirement for order<5 would make more sense for an IIR filter. You could filter this with either but you may ultimately be concerned with a maximum tolerable delay. The cutoff freq would typically be where you want the filter to start rolling off, but from your plot and description I think you mean the start of the stopband frequency? What is driving your specs? (Is this a homework problem, or an actual application? And if an application what is the goal?) $\endgroup$ Commented Mar 23 at 15:20
  • $\begingroup$ This is for an assignment where artificial noise has been put over an original signal where we are being expected to create both FIR and IIR digital filters to get back to the original signal and both must have a maximum order of 5. I had assumed the cut-off would be relating to the passband frequency $\endgroup$
    – EEE22
    Commented Mar 23 at 15:30
  • $\begingroup$ Got it, the assignment must be to show you how much better the IIR filter will be when you are limited in total order. Can you also show the spectrum before the noise is added or can we assume it is identical to the spectrum above without the portion that starts after f>100? The plots would be more useful if the vertical axis was in dB. Your filter performance is maximized when you can increase the distance between passband and cutoff so you want the passband as small as acceptable and stopband as high as possible; without seeing the signal without noise, it is tough to set that. $\endgroup$ Commented Mar 23 at 15:36
  • $\begingroup$ I will edit the post to show the DFT on the original signal but it shows exactly what you said. I understand what you are saying about the gap between passband and stopband. $\endgroup$
    – EEE22
    Commented Mar 23 at 15:45
  • $\begingroup$ ok I'll add some advice as an answer $\endgroup$ Commented Mar 23 at 15:47

1 Answer 1


Some helpful advice:

The order of 5 for an FIR filter is very small. I assume from the OP's comment that the exercise will be to compare FIR and IIR filters for very small order.

Plotting the spectrum in dB is typically more useful for purpose of filter design, where similarly we would review the frequency magnitude response of the filter in dB units as well. I assume the "noise" component starts at 100 Hz.

With the design of filters there is always going to be a trade. If we are restricted to an order of 5, we cannot also set the stop band attenuation; the order sets that. What we can do for all filter types is maximize the possible stopband attenuation by making the transition band (distance between passband edge and stopband edge for a low pass filter, as a ratio of the sampling rate) as large as possible. This will maximize the filter rejection for a given number of resources (This is a motivation to use as low of a sampling rate as possible). "Passband" is the band where we meet a maximum "in-band" ripple or minimum attenuation requirement, and "Stopband" is the band where we meet a minimum attenuation requirement.

With that in mind we want to make the target stopband start as high as possible, and make the passband as narrow as possible in order to minimize the number of coefficients (resources) needed to meet a target requirement. We cannot both set the order and meet a passband and stopband requirement; we have to set one and then determine the other. So in the OP's case, if it is a hard requirement that the order be 5, then we will be set with the passband and stopband that we get for a given filter design method (between windowing, least squares, equiripple etc when designing FIR filters). The windowing technique is one approach to design FIR filters, and for that the cutoff frequency is a -6 dB cutoff that is half way between the passband and stopband. The transition width will be given by the window used and number of taps (which is 1 more than the "filter order")-- so as mentioned a 6 tap FIR filter will have a very wide transition band and likely not be very effective for this application). An FIR filter with significantly more coefficients (91 taps or more) would make more sense as having any effect in this case. For that we can meet any reasonable requirement of passband and stopband by selecting the total number of coefficients with the trade being overall delay and filter complexity.

I copied the OP's spectrum below to show a possible location for the cutoff frequency, assuming we want to reject above 100 Hz and maintain the signal at 60 Hz and below. Ultimately with an order of only 5 both the noise will persist and a good portion of the signal will be attenuated, so the trade will ultimately be in the balance between the two as set by the cutoff frequency used.

FFT of signal and noise

If implementing an IIR filter, performance for passband and stopband will be greatly improved within the constraint of order =5, but the further choice would be in filter type (Chebychev, elliptic, Butterworth etc) where other design trades come into play beyond order and attenuation (notably group delay distortion).


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.