How to apply a FIR filter?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Antworten (3)
Sebastian Gatzka
am 17 Jan. 2012
Try to find the correct filter with the FDATOOL. Once you have found it you can implement it into your code!
0 Kommentare
Wayne King
am 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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Digital Filter Design finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!