How to apply a FIR filter?

10 views (last 30 days)
Neuron
Neuron on 30 Dec 2011
I have a sound signal sampled at 44100Hz and I want to keep the frequencies 100 to 800 Hz. How can I do this with a FIR filter using the default hamming window? What are the correct values for order n, ripple etc. It seems hard to find this information.. thank you in advance.

Answers (3)

Abhishek Gupte
Abhishek Gupte on 11 Jan 2012
Try using the FDATOOL.
  1 Comment
Neuron
Neuron on 17 Jan 2012
I have to write code, gui not useful.
ty

Sign in to comment.


Sebastian Gatzka
Sebastian Gatzka on 17 Jan 2012
Try to find the correct filter with the FDATOOL. Once you have found it you can implement it into your code!

Wayne King
Wayne King on 17 Jan 2012
Are you sure you want to use the window method in this case?
At any rate, for the window method, the wider the main lobe, the smaller the side lobes and hence the smaller the ripple. Values for the more popular windows including the Hamming are published.
For the Hamming, the main lobe in radians per sample is (8*pi)/M where M is the length of the window (order of your filter-1). Accordingly, to determine your order take the width of main lobe (the passband width), set that equal to (8*pi)/M and solve for M
The first sidelobe for the Hamming window is around -53 dB, so that equals a ripple of 20*log10(delta) = -53
Let's say you want a passband (mainlobe width) of 0.3pi-0.1pi=0.2pi. You can solve for the order: 0.2pi = (8pi)/M M = 40
To design the filter (I'll just make the order 40, which gives 41 coefficients)
d = fdesign.bandpass('N,Fc1,Fc2',40,0.1,0.3);
Hd = window(d,'window',@hamming);
fvtool(Hd);
Make the necessary adjustments for specifications in Hz.
And just FYI, you can design the filter in FDATool and then generate the MATLAB with File -> Generate MATLAB Code

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!