PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

68 Practical MATLAB® Applications for Engineers


Example 1.9

Given the following analog transfer function:

Hs
sss
sssss
()



32
5432

353

(^96245)
Create the script fi le responses that returns the plots of the impulse and step responses
over the range given by 30 ≤ t ≤ 40.
MATLAB Solution
% Script file: responses
P= [1 3 5 -3];
Q= [9 -6 2 -4 1 5]; t = 0:0.5:50;
subplot(2,1,1);
Y1 = impulse(P,Q,t);
plot(t, Y1);
a xis([30 40 -1e10 500e10])
title(‘analog impulse response’);
xlabel(‘time’);ylabel(‘Amplitude ’)
subplot(2,1,2);
Y2 = step(P,Q,t);
plot(t, Y2);ylabel(‘Amplitude ’);
a xis([30 40 -16e9 1e13]);
title(‘analog step response’); xlabel (‘time’)
The script fi le responses is executed and the results are shown in Figure 1.58.
FIGURE 1.58
Plots of system responses of Example 1.9.
× 1012 analog impulse response
× 1012
5 4 3 2 1 0
30
30 31 32 33 34 35 36 37 38 39 40
(^31323334353637383940)
Amplitude
Amplitude
time
analog step response
10
8
6
4
2
0
time

Free download pdf