How to apply a FIR filter?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(3 个)
Sebastian Gatzka
2012-1-17
Try to find the correct filter with the FDATOOL. Once you have found it you can implement it into your code!
0 个评论
Wayne King
2012-1-17
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!