# Designing A Filter Using SPTool In Matlab

I am currently working on learning DSP and for my course we use Matlab. I have been tasked with designing a low-pass filter using SPTool with the following specification:

A Low-Pass Kaiser Window FIR filter with a cut-off at 200hz.

Now, when i open the SPTool and choose "new" i get the filter design and analysis window. I use the following settings

• Response Type = "Lowpass"
• Design Method = "FIR" and "Window"
• Window = "Kaiser"

I would like to know which values i should put into the "Fs" and "FPass" fields. The signal i am applying this filter to is a periodic 100hz wave.

Thanks for any feedback.

• I Rather than FPass, I mean the two fields of Fs and Fc – John Smith Mar 17 '12 at 0:18

"Fs" should be set to the sample rate of your input signal. Hopefully you know what the sample rate is. If you don't, say something.

You need the cutoff frequency, "Fc", to be 200 Hz. That means all signal content at 200 Hz and above will be heavily attenuated. You need to keep the signal at 100 Hz, so 100 Hz needs to be inside the pass band (the frequency range that the filter doesn't attenuate). You could make "Fpass" (the highest frequency that your filter will "pass" through) 100 Hz, but I would put a little margin in and make it 120 Hz, or something like that. I'm not familiar with SPTool, but you'll probably need to tell it how much to attenuate the stop band frequencies. You can put anything, but usually 50 dB or more is good.

The frequency range in between your pass band and the stop band is the "transition band". The bigger you make the transition band (relative to the pass band), the easier it is for your filter to do a good job of attenuating the stop band without introducing distortions in your pass band. So that would be an argument for setting your pass band limit, Fpass, to 100 Hz, which would make your transition band 100 Hz wide. As you are hopefully starting to see, designing a filter involves a lot of tradeoffs.

John Smith,

You are designing a low pass filter, which means that your filter will be applied, (convolved) against a signal, whereby it will attenuate certain frequencies, and leave other frequencies more or less untouched.

So in a low pass filter, generally that means that you will filter out (heavily attenuate) frequencies that are 'high'. Your $f_{pass}$ just quantifies this for you. How high is high? Well, if you want a 'cutoff' at 200 Hz, then that generally means you want to keep frequencies at roughly 200 Hz and below, so pick $f_{pass}$ to be 200 Hz.

But bear in mind, you usually have a specification about transition bandwidth. If your filter is infinitely sharp, you can say that you accept all frequencies less than 200, and attenuate all frequencies above 200. Realistically however you might want to accept all frequencies less than say, 130, and then from 130 to 200 you are transitioning, and then heavily attentuate all frequencies greater than 200.

Regarding the sampling rate, that is really dependent on your simulation. If you pick 10,000 Hz as your sampling rate, then you should make sure that when you use your filter on a signal, that it too was sampled at 10,000 Hz.

It is good that you are using MATLAB. It is a very powerful tool in understanding DSP concepts.

• No, no! "Low pass" means that you pass, as in let through, low frequencies. You heavily attenuate the high frequencies. – Jim Clay Mar 17 '12 at 1:58
• @JimClay Offf! It was a long day for me today! Thanks, I corrected the typo. :-) – Spacey Mar 17 '12 at 2:02
• No worries. I have those days myself. – Jim Clay Mar 17 '12 at 2:06
• I think you are misinterpreting the 200 Hz parameter. I believe that he is saying that 200 Hz needs to be the start of the stop band, not the end of the pass band. – Jim Clay Mar 17 '12 at 10:44
• @JimClay Well, barring any transition region spec, I am assuming his cut-off as being a sharp 200 Hz. Eitherway, I edited for more clarity. – Spacey Mar 18 '12 at 0:49