University of Engineering & Technology Lahore: Theory
University of Engineering & Technology Lahore: Theory
Faculty of Engineering
Experiment # 11
Equipment Required: Personal computer (PC) with windows operating system and MATLAB
software
Theory:
There are three basic prototypes (Butterworth, Chebyshev, Elliptic) of IIR filters are widely used
in practice. We have discussed butterworth analog and digital filter in previous lab. In this lab, we
will design chebyshev filter and its transformation in digital filters.
There are two types of Chebyshev filters. The Chebyshev-I filters have equiripple response in
the passband, while the Chebyahev-II filters have epiripple response in the stopband.
Butterworth filters have monotonic response in both bands. By choosing a filter that has an
equiripple rather than a monotonic behavior, we can obtain a lower-order filter. Therefore,
Chebyshev filters provide lower order than Butterworth filters for the same specifications
where N is the order of the filter, ϵ is the passband ripple factor, which is related to Rp, and
𝑇𝑁 (X) is the Nth-order Chebyshev polynomial given
The equiripple response of the Chebyshev filters is due to this polynomial 𝑇𝑁 (x). Its key properties
are
(a) for 0 < x < 1, 𝑇𝑁 (x) oscillates between -1 and 1,
(b) for 1< x < ∞, 𝑇𝑁 (x) increases monotonically to ∞.
There are two possible shapes of |𝐻𝑎 (𝑗𝛺)|2,one for N odd and one for N even as shown below.
Note that X = Ω/𝛺𝑐 is the normalized frequency.
Designing Equations:
MATLAB provides a function called [z, p, k] =cheb1ap(N, Rp) to design a normalized Chebyshev-
I analog prototype filter of order N and pass band ripple Rp and that returns zeros in z array, poles
in p array, and the gain value k. Un-normlized Chebyshev-I filter with arbitrary R is achieved by
scaling the array p of the normalized filter by R,. Similar to the Butterworth prototype, this filter
has no zeros. In the following function, called u-chb1ap(N, Rp, Omegac), we design an un-
normalized Chebyshev-I analog prototype filter that returns Ha(s) in the direct form.
𝐴𝑠 = 𝑠𝑡𝑜𝑝𝑏𝑎𝑛𝑑 𝑟𝑖𝑝𝑝𝑙𝑒
Assignment 1:
Design a lowpass chebyshev-1 analog filter using to satisfy
Passband cutoff = 0.2π; Passband ripple: = 1dB
Stopband frequency = 0.3π; Stopband ripple: = 16dB
Plot magnitude response, phase response and magnitude in dB of analog filter.
function [b,a] = afd_chb1(Wp,Ws,Rp,As);
% Analog Lowpass Filter Design: Chebyshev-1
% -----------------------------------------
% [b,a] = afd_chb1(Wp,Ws,Rp,As);
% b = Numerator coefficients of Ha(s)
% a = Denominator coefficients of Ha(s)
% Wp = Passband edge frequency in rad/sec; Wp > 0
% Ws = Stopband edge frequency in rad/sec; Ws > Wp > 0
% Rp = Passband ripple in +dB; (Rp > 0)
% As = Stopband attenuation in +dB; (As > 0)
%
if Wp <= 0
error('Passband edge must be larger than 0')
end
if Ws <= Wp
error('Stopband edge must be larger than Passband edge')
end
if (Rp <= 0) | (As < 0)
error('PB ripple and/or SB attenuation ust be larger than 0')
end
ep = sqrt(10^(Rp/10)-1); A = 10^(As/20);
OmegaC = Wp; OmegaR = Ws/Wp; g = sqrt(A*A-1)/ep;
N = ceil(log10(g+sqrt(g*g-1))/log10(OmegaR+sqrt(OmegaR*OmegaR-1)));
fprintf('\n*** Chebyshev-1 Filter Order = %2.0f \n',N)
[b,a]=u_chb1ap(N,Rp,OmegaC);
End
[R,p,k] = residue(c,d);
p = exp(p*T);
[b,a] = residuez(R,p,k) ;
b = real(b'); a = real(a');
end
function [C,B,A] = dir2par(b,a);
% Dim-form to PWLEL-form conversion
% -------------------------------------
% [C,B,A] = dir2par(b,a)
% C = Polynomial part when length(b) >= length(a)
% B = K by 2 matrix of real coefficients containing bk's
% A = K by 3 matrix of real coefficients containing ak's
% b = numerator polynomial coefficients of DIRECT form
% a = denominator polynomial coefficients of DIRECT form
M = length(b) ; N = length(a);
[r1,p1,C] = residuez(b,a);
p = cplxpair(p1,10000000*eps);
I = cplxcomp(p1 ,p);
r = r1(I);
K = floor(N/2); B = zeros(K,2); A = zeros(K,3);
if K*2 == N; %N even, order of A(z) odd, one factor is first order
for i=1:2:N-2
Brow = r(i:1:i+1,:);
Arow = p(i:1:i+1,:);
[Brow,Arow] = residuez(Brow,Arow,[]);
B(fix((i+1)/2), :) = real(Brow) ;
A(fix((i+1)/2), :) = real(Arow);
end
[Brow,Arow] = residuez(r(N-1) ,p(N-1), []) ;
B(K,:) = [real(Brow) 0]; A(K,:) = [real(Arow) 0];
else
for i=1:2:N-1
Brow = r(i:1:i+1,:);
Arow = p(i:1:i+1,:);
[Brow,Arow] = residuez(Brow, Arow,[] );
B(fix((i+1)/2), :) = real(Brow) ;
A(fix((i+1)/2), :) = real(Arow);
end
end