Digital filter using code

8 次查看(过去 30 天)
jimmi1
jimmi1 2013-12-20
编辑: Wayne King 2013-12-20
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 个评论
Wayne King
Wayne King 2013-12-20
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?
jimmi1
jimmi1 2013-12-20
Hi Wayne,
I am using Matlab 2013, I first tried to design the filter using matlab code, when that failed I tried using the "Filter design and analysis" toolbox located in the "signal processing and communications" section. As mentioned this also failed to produce the results I needed. I tried all of the low-pass filters available all of which would not produce the result i needed.
example: I tried to create an FIR filter using Equiripple algorithm, this was not possible and said a higher order "3" was needed.
In other algorithms I could not enter all of the specifications of my filter.
Example: if I use a butterworth and I specify the order number I can not specify Apass or Astop. If I let it decide the order number for me and I supply Apass and Astop it builds a filter with a 5th order.
Thanks

请先登录,再进行评论。

回答(1 个)

Wayne King
Wayne King 2013-12-20
编辑:Wayne King 2013-12-20
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

类别

Help CenterFile Exchange 中查找有关 Digital Filter Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by