You are here : matlabSignal Processingellip

# ellip() - Signal Processing

```example[b,a] = ellip(n,Rp,Rs,Wp) returns
the transfer function coefficients of an nth-order
lowpass digital elliptic filter with normalized passband edge frequency Wp.
The resulting filter has Rp decibels of peak-to-peak
passband ripple and Rs decibels of stopband attenuation
down from the peak passband value.
example[b,a] = ellip(n,Rp,Rs,Wp,ftype) designs
a lowpass, highpass, bandpass, or bandstop elliptic filter, depending
on the value of ftype and the number of elements
of Wp. The resulting bandpass and bandstop designs
are of order 2n.
Note:

See Limitations for information
about numerical issues that affect forming the transfer function.
example[z,p,k] = ellip(___) designs
a lowpass, highpass, bandpass, or bandstop digital elliptic filter
and returns its zeros, poles, and gain. This syntax can include any
of the input arguments in previous syntaxes.
example[A,B,C,D] = ellip(___) designs
a lowpass, highpass, bandpass, or bandstop digital elliptic filter
and returns the matrices that specify its state-space representation.

example[___] = ellip(___,'s') designs
a lowpass, highpass, bandpass, or bandstop analog elliptic filter
with passband edge angular frequency Wp, Rp decibels
of passband ripple, and Rs decibels of stopband
attenuation.```

### Syntax

`[b,a] = ellip(n,Rp,Rs,Wp) example[b,a] = ellip(n,Rp,Rs,Wp,ftype) example[z,p,k] = ellip(___) example[A,B,C,D] = ellip(___) example[___] = ellip(___,'s') example`

### Example

```Lowpass Elliptic Transfer FunctionOpen This Example
Design a 6th-order lowpass elliptic filter with 5 dB of passband ripple, 40 dB of stopband attenuation, and a passband edge frequency of 300 Hz, which, for data sampled at 1000 Hz, corresponds to
rad/sample. Plot its magnitude and phase responses. Use it to filter a 1000-sample random signal.
[b,a] = ellip(6,5,40,0.6);
freqz(b,a)
dataIn = randn(1000,1);
dataOut = filter(b,a,dataIn);

Bandstop Elliptic FilterOpen This Example
Design a 6th-order elliptic bandstop filter with normalized edge frequencies of
and
rad/sample, 5 dB of passband ripple, and 50 dB of stopband attenuation. Plot its magnitude and phase responses. Use it to filter random data.
[b,a] = ellip(3,5,50,[0.2 0.6],'stop');
freqz(b,a)
dataIn = randn(1000,1);
dataOut = filter(b,a,dataIn);

Highpass Elliptic FilterOpen This Example
Design a 6th-order highpass elliptic filter with a passband edge frequency of 300 Hz, which, for data sampled at 1000 Hz, corresponds to
rad/sample. Specify 3 dB of passband ripple and 50 dB of stopband attenuation. Plot the magnitude and phase responses. Convert the zeros, poles, and gain to second-order sections for use by fvtool.
[z,p,k] = ellip(6,3,50,300/500,'high');
sos = zp2sos(z,p,k);
fvtool(sos,'Analysis','freq')

Bandpass Elliptic FilterOpen This Example
Design a 20th-order elliptic bandpass filter with a lower passband frequency of 500 Hz and a higher passband frequency of 560 Hz. Specify a passband ripple of 3 dB, a stopband attenuation of 40 dB, and a sample rate of 1500 Hz. Use the state-space representation. Design an identical filter using designfilt.
[A,B,C,D] = ellip(10,3,40,[500 560]/750);
d = designfilt('bandpassiir','FilterOrder',20, ...
'PassbandFrequency1',500,'PassbandFrequency2',560, ...
'PassbandRipple',3, ...
'StopbandAttenuation1',40,'StopbandAttenuation2',40, ...
'SampleRate',1500);
Convert the state-space representation to second-order sections. Visualize the frequency responses using fvtool.sos = ss2sos(A,B,C,D);
fvt = fvtool(sos,d,'Fs',1500);
legend(fvt,'ellip','designfilt')

Comparison of Analog IIR Lowpass FiltersOpen This Example
Design a 5th-order analog Butterworth lowpass filter with a cutoff frequency of 2 GHz. Multiply by
to convert the frequency to radians per second. Compute the frequency response of the filter at 4096 points.n = 5;
f = 2e9;

[zb,pb,kb] = butter(n,2*pi*f,'s');
[bb,ab] = zp2tf(zb,pb,kb);
[hb,wb] = freqs(bb,ab,4096);
Design a 5th-order Chebyshev Type I filter with the same edge frequency and 3 dB of passband ripple. Compute its frequency response.[z1,p1,k1] = cheby1(n,3,2*pi*f,'s');
[b1,a1] = zp2tf(z1,p1,k1);
[h1,w1] = freqs(b1,a1,4096);
Design a 5th-order Chebyshev Type II filter with the same edge frequency and 30 dB of stopband attenuation. Compute its frequency response.[z2,p2,k2] = cheby2(n,30,2*pi*f,'s');
[b2,a2] = zp2tf(z2,p2,k2);
[h2,w2] = freqs(b2,a2,4096);
Design a 5th-order elliptic filter with the same edge frequency, 3 dB of passband ripple, and 30 dB of stopband attenuation. Compute its frequency response.[ze,pe,ke] = ellip(n,3,30,2*pi*f,'s');
[be,ae] = zp2tf(ze,pe,ke);
[he,we] = freqs(be,ae,4096);
Plot the attenuation in decibels. Express the frequency in gigahertz. Compare the filters.plot(wb/(2e9*pi),mag2db(abs(hb)))
hold on
plot(w1/(2e9*pi),mag2db(abs(h1)))
plot(w2/(2e9*pi),mag2db(abs(h2)))
plot(we/(2e9*pi),mag2db(abs(he)))
axis([0 4 -40 5])
grid
xlabel('Frequency (GHz)')
ylabel('Attenuation (dB)')
legend('butter','cheby1','cheby2','ellip')

The Butterworth and Chebyshev Type II filters have flat passbands and wide transition bands. The Chebyshev Type I and elliptic filters roll off faster but have passband ripple. The frequency input to the Chebyshev Type II design function sets the beginning of the stopband rather than the end of the passband.```