fir and iir filtering
5 views (last 30 days)
Show older comments
can any one give me the code for fir and iir lowpass and highpass filters of a given input sequence. regards k.v.swamy
0 Comments
Accepted Answer
Wayne King
on 19 Mar 2012
You have to know your filter specifications. If you do, you can do both with fdesign.lowpass and fdesign.highpass
fdesign.lowpass and fdesign.highpass have different specification strings which support different filter designs.
The default string 'Fp,Fst,Ap,Ast' supports both FIR and IIR designs.
Here is an example:
Design a lowpass filter with a passband frequency of 1 kHz, a stopband frequency of 1.5 kHz, passband ripple of 0.5 dB, and stopband attenuation of 40 dB. The sampling frequency is 20 kHz
d = fdesign.lowpass('Fp,Fst,Ap,Ast',1e3,1.5e3,0.5,40,20e3);
designmethods(d) %shows which designs are valid for this spec
Hdeq = design(d,'equiripple'); % FIR filter
Hbutt = design(d,'butter'); %IIR design
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!