MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by MEHRDAD
on 18 Aug 2011

Hi I would like to design a 8th order Chebyshev type I low pass filter with a cutoff frequency of 50 Hz and then re-sample the data at rate if 125HZ. These are the only information that I have. In matlab I have to also provide ripple in the passband and a passband edge frequency. How should I design a filter using the information I have. Thanks a lot

*No products are associated with this question.*

Answer by Arturo Moncada-Torres
on 18 Aug 2011

Accepted answer

I recommend you to use the Filter Design and Analysis Tool. It is very easy to use, intuitive and you can generate the corresponding code to use it where you want. Just type

fdatool

**EDIT**
In this case, you would have to choose the following:

* Response Type: Lowpass - Explanation: Obvious * Design Method: IIR Chebyshev Type I - Explanation: Obvious * Filter Order: 8 - Explanation: Obvious * Frequency specifications + Units: Hz - Explanation: Easier to visualize and understand + Sampling frequency (Fs): 125 - Explanation: Obvious + Pass Frequency: 49.350359831403956 (IMPORTANT: always try to use as many decimals as possible. You would be amazed at how these can make a difference). - Explanation: In MATLAB you define a Chebyshev I LPF in function of its pass frequency Fp (and NOT in function of its cut off frequency Fc). Fortunately, there is a way to calculate Fp from Fc, which is as follows:

fp = fc / (cosh((acosh(1/(sqrt((10^(0.1*Apass))-1))))/N));

Where: fc = Cut off frequency Apass = Ripple in the pass band (in dB) N = Order

* Magnitude specifications + Units: dB - Explanation: Easier to visualize and understand + Apass: 1 - Explanation: This parameter refers to the amplitude of the pass band ripple (remember every Chebyshev Type I filter has ripple in the pass band). Normally I would recommend a much smaller value (0.1, 0.01, etc.). However, we will leave this case as 1 to make the ripple more evident.

Clic on "Design Filter". You will see the magnitude response, which matches with the desired filter behavior. If you want more information about Chebyshev (and other) filters, I recommend you this link. Even though it talks about analogue filters, most of the concepts apply to digital filters. You will find in it information that you would not find in any other place, including books (believe, I have consulted a lot of them).

This is the easy way. If you want, you can generate the filter from scratch code. However... That is a complete new story :-P.

Show 2 older comments

MEHRDAD
on 19 Aug 2011

Thanks again. How ever using Fp=49.350359831403956 and Fs=50 generates the following error while designing the filter:

error: frequency specification must be between 0 and 1.

Arturo Moncada-Torres
on 19 Aug 2011

My mistake. Just correct Fs. It should be 125 (and not 50).

Answer by Honglei Chen
on 18 Aug 2011

Hi Mehrdad,

Like you mentioned, you need to know the passband ripple. You may be able to treat your cutoff frequency as the passband edge frequency but you still need passband ripple to specify a Chebyshev 1 filter.

With a sampling rate of 125 Hz, assume that passband edge is at 50 Hz and a passband ripple of 0.1 dB, you can design a Chebyshev I filter as

h = fdesign.lowpass('N,F3dB,Ap',8,50,0.1,125); hd = design(h,'cheby1'); fvtool(hd);

HTH,

Honglei

## 0 Comments