How to design a FIR filter with two pass bands
4 次查看(过去 30 天)
显示 更早的评论
I need to carry out a FIR type multiple bandpass filter of order 100 and want to know how can "firls function" be useful.
Given Data :
-Sampling frequency : 500Hz
- Center frequencies : 20 Hz and 180Hz
- Bandwidth amplitudes : 1 and 5
- Bandwidth : 20 Hz
- Width of the rise and fall regions : 15 Hz
Any documentation or help would be really appreciated.
0 个评论
回答(1 个)
Star Strider
2020-12-29
Try this:
Fs = 500; % Sampling Frequency
fcomb = [19 19.5 20.5 21 177 177.5 182.5 183]; % Frequency Vector
mags = [0 1 0 1 0]; % Magnitude Vector
dev = [0.5 0.1 0.5 0.1 0.5]; % Deviations
[n,Wn,beta,ftype] = kaiserord(fcomb,mags,dev,Fs);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');
figure
freqz(hh, 1, 2^20, Fs)
FrqLim = [0 250]; % Frequency Limits (Optional)
set(subplot(2,1,1), 'XLim',FrqLim) % Optional
set(subplot(2,1,2), 'XLim',FrqLim) % Optional
It should do what you want.
The ‘Optional’ set calls after freqz allow you to ‘zoom in’ on various parts of the spectrum if you want to, in order to see it more clearly and adjust the passbands to your requirements. Here, they are set to present the entire filter spectrum.
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Digital Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!