how can i design an FIR filter using matlab which can filter a range of frequencies from 20 Hz to 70 Hz. by generated a signal which contain frequencies of 10 Hz, 30 Hz, 50 Hz and 90 Hz

which can filter a range of frequencies from 20 Hz to 70 Hz. by generated a signal which contain frequencies of 10 Hz, 30 Hz, 50 Hz and 90 Hz

2 Comments

u want the code for that or the idea for how to make it?
When you say "filter", do you mean that you want to remove as much as practical in the range 20 Hz to 70 Hz? Or are you looking for a comb filter to remove 20 Hz, 40 Hz, and 70 Hz? Or to remove 20 Hz, 40 Hz, 60 Hz and 70 Hz?

Sign in to comment.

Answers (1)

There are many ways in MATLAB to design an FIR filter using the Signal Processing Toolbox. A key piece of information you neglected to give us is the sampling frequency.
For this example, I'll assume it is 1000 Hz, but you need to use your correct sampling frequency. This filter will pass frequencies from 20 to 70 (I agree with Walter that it is not clear whether you want to keep those frequencies, or get rid of them).
Fs = 1000;
d = fdesign.bandpass('Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2', 10,20,70,80,50,0.5,50,Fs);
Hd = design(d);
% view filter magnitude response
fvtool(Hd)
% filter you data
output = filter(Hd,input);
To remove 20 to 70, you can use fdesign.bandstop
d = fdesign.bandstop('Fp1,Fst1,Fst2,Fp2,Ap1,Ast,Ap2',10,20,70,80,0.5,50,0.5,Fs);
% view filter's magnitude response
fvtool(Hd)
% filter you data
output = filter(Hd,input);

Tags

Asked:

on 13 Jul 2012

Community Treasure Hunt

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

Start Hunting!