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