634 Practical MATLAB® Applications for Engineers
Example 6.11Create the script fi le Cheby_1_2 that tests the design of the Chebyshev/types 1 and 2 HO
digital fi lter of Example 6.9 and returns their outputs by applying as input the signal
x(t) = 2 + cos(0.2 * t) + cos(0.5 * t) sampled at the rate T = 0.3.
a. Obtain plots of each component of x(t).
b. Obtain plots of the discrete input signal and the corresponding fi lter’s outputs.
c. Analyze and discuss each fi lter’s output and state which of the two has a better
performance.MATLAB Solution
% Script file: Cheby _ 1 _ 2,
Pz1 = [0.8006 -2.4019 2.4019 -0.8006]; % num. and den. of digital filter
type 1
Qz1 = [1.0000 -2.5767 2.2067 -0.6217];
Pz2 = [0.9564 -2.8530 2.8530 -0.9564]; % num. and den. of digital filter
type 2
Qz2 = [1.0000 -2.8943 2.8098 -0.9147];
n = 0:1:300; % discrete time sequence
T = 0.3;
Dc = 2.*ones(1,301);
f1 = 2*cos(.2*T.*n);
f2 = cos(.5*T.*n);
figure(1)
subplot(3,1,1)
plot(n*T,dc);FIGURE 6.60
Analog and discrete fi lter’s input and output of Example 6.10.
5[x (t ) 2 cos (0.2.*t) cos (4. *t)] versus t4
3
2
1012345t in secAmplitude0Amplitude43210
0 2468t in secy (t) versus t0012345x (nT) versus nTAmplitude123
time index nT45y (nT) versus nTtime index nT0246843210Amplitude