Low order narrow FIR band pass filter
Show older comments
I need to design a 0.15-1.5Hz FIR band pass filter for the TMS320F2808PZA TI processor with sampling frequency of 300Hz and a maximum order of around 500 if symmetric (or 250 if not) because of RAM. I tried using the Parks-McClellan algorithm using two low pass filters and subtracting them as given in the code below. However, I could only get a 0.4-2.9 Hz filter since we need to use a maximum order of around 500. The passband ripple of the filter should be as low as possible. What type of filter should I use? Thanks for your help.
The 0.4 low pass filter code is given below:
%% LP1Hz filter Designrp = 0.5; % Passband ripple
rs = 65; % Stopband ripple
fs = 300; % Sampling frequency
f = [0.00 1.309]; % Cutoff frequencies
a = [1 0]; % Desired amplitudes
% Compute deviations
dev = [(10^(rp/20)-1)/(10^(rp/20)+1) 10^(-rs/20)];
[n,fo,ao,w] = firpmord(f,a,dev,fs);
b = firpm(n,fo,ao,w);
bb=min(floor(log2((2^31-1)/max(abs(b)))),ceil(64-32-log2(sum(abs(b)))));
B=round(b*2^bb);
LP_Scaling = round(2^bb*sum(b));
The 2.9 Hz low pass filter code is given below:
%% LP2.9Hz filter Design
rp = 0.01; % Passband ripple
rs = 120; % Stopband ripple
fs = 300; % Sampling frequency
f = [2 5.001]; % Cutoff frequencies
a = [1 0]; % Desired amplitudes
% Compute deviations
dev = [(10^(rp/20)-1)/(10^(rp/20)+1) 10^(-rs/20)];
[n,fo,ao,w] = firpmord(f,a,dev,fs);
b = firpm(n,fo,ao,w);
bb=min(floor(log2((2^31-1)/max(abs(b)))),ceil(64-32-log2(sum(abs(b)))));
B=round(b*2^bb);
LP_Scaling = round(2^bb*sum(b));
Answers (1)
Wayne King
on 9 Feb 2012
Hi do you have the Signal Processing Toolbox? First I would question whether you really need a bandpass here when you want your lowest passband frequency at only 0.1 Hz, why not just remove the mean (DC) from the signal and then use a lowpass filter.
For example:
d = fdesign.lowpass('Fp,Fst,Ap,Ast',1.5,3,0.5,40,300);
Hd = design(d);
Gives you an equiripple FIR design of order 326.
Categories
Find more on Filter Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!