634 Practical MATLAB® Applications for Engineers
Example 6.11
Create 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 t
4
3
2
1
012345
t in sec
Amplitude
0
Amplitude
4
3
2
1
0
0 2468
t in sec
y (t) versus t
0
0
1
2
3
4
5
x (nT) versus nT
Amplitude
123
time index nT
45
y (nT) versus nT
time index nT
02468
4
3
2
1
0
Amplitude