Clear Filters
Clear Filters

How to design a FIR filter with two pass bands

4 views (last 30 days)
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.

Answers (1)

Star Strider
Star Strider on 29 Dec 2020
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 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!