You are here : matlab → Signal Processing → cheby1
# cheby1() - Signal Processing

### Syntax

### Example

### Output / Return Value

### Limitations

### Alternatives / See Also

### Reference

example[b,a] = cheby1(n,Rp,Wp) returns the transfer function coefficients of an nth-order lowpass digital Chebyshev Type I filter with normalized passband edge frequency Wp and Rp decibels of peak-to-peak passband ripple. example[b,a] = cheby1(n,Rp,Wp,ftype) designs a lowpass, highpass, bandpass, or bandstop Chebyshev Type I 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] = cheby1(___) designs a lowpass, highpass, bandpass, or bandstop digital Chebyshev Type I 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] = cheby1(___) designs a lowpass, highpass, bandpass, or bandstop digital Chebyshev Type I filter and returns the matrices that specify its state-space representation. example[___] = cheby1(___,'s') designs a lowpass, highpass, bandpass, or bandstop analog Chebyshev Type I filter with passband edge angular frequency Wp and Rp decibels of passband ripple.

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

Lowpass Chebyshev Type I Transfer FunctionOpen This Example Design a 6th-order lowpass Chebyshev Type I filter with 10 dB of passband ripple 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] = cheby1(6,10,0.6); freqz(b,a) dataIn = randn(1000,1); dataOut = filter(b,a,dataIn); Bandstop Chebyshev Type I FilterOpen This Example Design a 6th-order Chebyshev Type I bandstop filter with normalized edge frequencies of and rad/sample and 5 dB of passband ripple. Plot its magnitude and phase responses. Use it to filter random data. [b,a] = cheby1(3,5,[0.2 0.6],'stop'); freqz(b,a) dataIn = randn(1000,1); dataOut = filter(b,a,dataIn); Highpass Chebyshev Type I FilterOpen This Example Design a 9th-order highpass Chebyshev Type I filter with 0.5 dB of passband ripple and a passband 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] = cheby1(9,0.5,300/500,'high'); sos = zp2sos(z,p,k); fvtool(sos,'Analysis','freq') Bandpass Chebyshev Type I FilterOpen This Example Design a 20th-order Chebyshev Type I 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 and a sample rate of 1500 Hz. Use the state-space representation. Design an identical filter using designfilt. [A,B,C,D] = cheby1(10,3,[500 560]/750); d = designfilt('bandpassiir','FilterOrder',20, ... 'PassbandFrequency1',500,'PassbandFrequency2',560, ... 'PassbandRipple',3,'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,'cheby1','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.