1
$\begingroup$

The matlab "ellip" function can be used to design the unquantised coefficient set.

From matlab website:

$ [b,a]=ellip(n,Rp,Rs,Wp) , $

n: order of filter

Wp: normalized passband edge frequency

Rp: ripple in passband (db)

Rs: db down from he peak value in the passband

If i have an 8th order IIR filter with the following transfer function magnitude response:

\begin{align*} 0\,\mathrm{db} \pm 1.5 \,\mathrm{db} & \quad \text{for } \quad 0.2<|v|<0.3 \cr \lt −60\,\mathrm{db} & \quad\text{for } \quad |v|<0.14\text{ and } |v|>0.36 \end{align*}

how i can fill the matlab function with the suitable values?

$\endgroup$
3
$\begingroup$

The quickest way would be

[b,a] = ellip(8,1.5,60,[.2 .3]);

This designs a bandpass from .2 to .3 with 1.5 dB ripple and 60 db stop band attenuation. You don't get to pick the edges of the stop band since you already pre-selected the order. You can do one or the other but not both at the same time. However the 8th order filter is more than enough to meet your stop band requirements. In fact the low band stops at 0.195 and the high stop band starts at 0.307.

Another wrinkle is that the ripple actually only goes down, i.e. passband is not between -1.5dB and +1.5 dB but only between -1.5dB and 0 dB. In order to work aound this (if you care) you can double the ripple to 3 dB and than simply add 1.5 dB gain. You would also have to increase the stop band attenuation to 61.5dB to compensate for the overall gain change. The funcion $ellipord$ allows to calculate the required order to achieve a certain stop band, so the correctest way would be

%% Ellip filter design example
[n,wp] = ellipord([.2 .3],[.14 .36],3,61.5);
[b,a] = ellip(n,3,61.5,wp);
% add 1.5 dB of gain
b = b*10.^(1.5/20);
[H,F]= freqz(b,a,1000,2);
plot(F,10*log10(H.*conj(H)));
set(gca,'ylim',[-70,3]);
grid('on');

So it turns out a 5th order elliptic filter can do the job just fine.

$\endgroup$
1
$\begingroup$

With the new answer (indirectly) pointing out that Hilmar's filter is of order ten and not eight, one may have to reinterpret the edges of the original question. It is easy to assume that they are normalized to the sampling frequency and not the Nyquist frequency (not only based on the eight-order assumption, but also that the filter in that case gives a symmetric filter which makes sense from a home work point of view).

Therefore, the corresponding line would be:

[b,a] = ellip(4,1.5,60,[.4 .6]);

However, this filter can also be designed as

[b,a] = ellip(4,1.5,60, 0.8, 'high');
b=upsample(b,2);
a=upsample(a,2);

%% Where one may want to shave the trailing zero off by:
b(10)=[];
a(10)=[];

In the final design, the transfer is made (visibly) periodic by replacing each delay element by two. There are of course low-pass to band-pass transformations to do the same thing.

$\endgroup$
0
$\begingroup$

I would like to expand Hilmar's answer for the benefit of those reading it as reference.

This function:

[b,a] = ellip(8,1.5,60,[.2 .3]);

Will actually produce a 16th order bandpass IIR filter according to the MATLAB documentation.

The first argument n will only be equal to the filter order if you are designing a low pass IIR filter, otherwise the filter order will be 2n.

Hence, if you want to get an 8th order IIR filter, you should use these arguments:

[b,a] = ellip(4,1.5,60,[.2 .3]);
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.