Digital Signal Processing Reference
In-Depth Information
A2D
, respectively. So also the coefficients of the numerator and denominator of
G(z)
can be obtained by typing
b
and
a
, respectively. If we type
A1, A2, G
,
or
H
, the program displays the transfer function as the ratio of two polynomi-
als. The program may not work successfully if the specifications call for a very
narrow transition band or a very high order for the filter, because of numerical
inaccuracy.
%This Matlab Program lp2apx.m obtains the allpass filters
%A
1
(z)
and A
2
(z)
from the lowpass (Butterworth, Chebyshev I
% and Elliptic) filters of odd order.
clear all
Wp=input('Enter the passband cutoff frequency between 0
and 1');
Ws=input('Enter the stopband cutoff frequency Wp<Ws<1');
Ap=input('Enter the max.attenuation in the passband');
As=input('Enter the min.attenuation in the stopband');
disp('As ftype,type in (1) for Butterworth, (2) for
Chebyshev I, (3) Chebyshev II and (4) for Elliptic
filters');
ftype=input('');
if ftype==1
disp('Butterworth Lowpass Filter');
[N,Wn]=buttord(Wp,Ws,Ap,As);
M=mod(N,2);
if M==0
N=N+1
end
[b,a]=butter(N,Wn);
end
if ftype==2
disp('Chebyshev I Lowpass Filter')
[N,Wn]=cheb1ord(Wp,Ws,Ap,As);
M=mod(N,2);
if M==0
N=N+1
end
[b,a]=cheby1(N,Ap,Wn);
end
if ftype==3
disp('Chebyshev II Lowpass filter')
[N,Wn]=cheb2ord(Wp,Ws,Ap,As);
M=mod(N,2);
if M==0
N=N+1
end
Search WWH ::
Custom Search