You are here : matlabSignal Processingcheby2

cheby2() - Signal Processing

example[b,a] = cheby2(n,Rs,Ws) returns
the transfer function coefficients of an nth-order
lowpass digital Chebyshev Type II filter with normalized
stopband edge frequency Ws and Rs decibels
of stopband attenuation down from the peak passband value.
example[b,a] = cheby2(n,Rs,Ws,ftype) designs
a lowpass, highpass, bandpass, or bandstop Chebyshev Type II
filter, depending on the value of ftype and the
number of elements of Ws. 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] = cheby2(___) designs
a lowpass, highpass, bandpass, or bandstop digital Chebyshev Type II 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] = cheby2(___) designs
a lowpass, highpass, bandpass, or bandstop digital Chebyshev Type II filter and returns the matrices that specify its state-space
representation.

example[___] = cheby2(___,'s') designs
a lowpass, highpass, bandpass, or bandstop analog Chebyshev Type II filter with stopband edge angular frequency Ws and Rs decibels
of stopband attenuation.


Syntax

[b,a] = cheby2(n,Rs,Ws) example[b,a] = cheby2(n,Rs,Ws,ftype) example[z,p,k] = cheby2(___) example[A,B,C,D] = cheby2(___) example[___] = cheby2(___,'s') example


Example

Lowpass Chebyshev Type II Transfer FunctionOpen This Example
Design a 6th-order lowpass Chebyshev Type II filter with 40 dB of stopband attenuation and a stopband 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] = cheby2(6,40,0.6);
freqz(b,a)
dataIn = randn(1000,1);
dataOut = filter(b,a,dataIn);

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

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

Bandpass Chebyshev Type II FilterOpen This Example
Design a 20th-order Chebyshev Type II bandpass filter with a lower stopband frequency of 500 Hz and a higher stopband frequency of 560 Hz. Specify 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] = cheby2(10,40,[500 560]/750);
d = designfilt('bandpassiir','FilterOrder',20, ...
    'StopbandFrequency1',500,'StopbandFrequency2',560, ...
    'StopbandAttenuation',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,'cheby2','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.


Output / Return Value


Limitations


Alternatives / See Also


Reference