PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Time Domain Representation of Continuous and Discrete Signals 71


figure(1)
subplot(2,2,1);
Y1 = filter(P, Q, I); n=0:29; yzero=zeros(1,30);
stem(n, Y1);hold on; plot (n,yzero);
title(‘impulse response using a sequence’);
ylabel (‘Amplitude imp. resp.’);
subplot (2,2,2);
Y2 = filter(P,Q,S);
stem (n, Y2);hold on; plot(n,yzero);
title(‘step response using a sequence’);
ylabel(‘Amplitude step resp.’);
subplot(2,2,3);
Y3 = dimpulse(P, Q, n);
stem(n, Y3);hold on; plot(n,yzero);
title(‘impulse response using dimpulse’);
ylabel (‘Amplitude imp.resp.’);
xlabel (‘time index n’);
subplot (2,2,4);
Y4 = dstep(P, Q, n);
stem(n, Y4); hold on; plot(n,yzero);
title(‘step response using dstep’);
ylabel(‘Amplitude step resp.’);
xlabel(‘time index n’)
The script fi le disc_tranf_func is executed and the results are shown in Figure 1.60.
Note that the results of part a fully agree with the results obtained in part b.

FIGURE 1.60
Plots of system responses of Example 1.11.

impulse response using a sequence
2

1

− 1

− 2

0

(^0102030)
Amplitude imp. resp.
impulse response using dimpulse
2
0
0
− 1
− 2
1
Amplitude imp. resp.
10 20 30
time index n
0102030
time index n
step response using a sequence
step response using dstep
1.5
1
0.5
−0.5
1.5
−0.5
0.5
0
1
0
0 10 20 30
Amplitude step resp.
Amplitude step resp.

Free download pdf