Digital filter using code
8 views (last 30 days)
Show older comments
Hi
I am trying to design a simple low pass digital filter (IIR or FIR) with the following characteristics. I would like to plot the filters response and calculate its transfer function.
Order(N) = 2
Band pass frequency (normalized)(wp)= 0.1
Band pass attenuation(ap) = 0dB(or as close as possible)
Stop band frequency (sf) = 0.4
Stop band attenuation (as) = at least -30dB
I have tried several methods but with such a low order I am finding it difficult to achieve these characteristics.
I would like to try and achieve this using Matlab code only, although I have tried using the digital filter design toolbox but still could not achieve the filter characteristics.
Any help would be greatly appreciated.
Thanks
2 Comments
Wayne King
on 20 Dec 2013
Please tell us which version of MATLAB you are using? When you say "digital filter design toolbox" do you mean the old MathWorks' Filter Design Toolbox?
Answers (1)
Wayne King
on 20 Dec 2013
Edited: Wayne King
on 20 Dec 2013
It's going to be difficult to get a good lowpass filter with such a low order (even IIR)
FIR:
d = fdesign.lowpass('N,Fp,Ap,Ast',2,0.1,0.5,30);
Hd = design(d);
fvtool(Hd)
% requires DSP System Toolbox -- this gets you very close but you have to increase order bit
d = fdesign.lowpass('N,Fp,Fst,Ast',4,0.1,0.4,30);
Hd = design(d);
If you enter:
measure(Hd)
You get
Passband Edge : 0.1
3-dB Point : 0
6-dB Point : 0
Stopband Edge : 0.4
Passband Ripple : 0.73383 dB
Stopband Atten. : 29.9978 dB
Transition Width : 0.3
0 Comments
See Also
Categories
Find more on Digital Filter Analysis 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!