Modern Control Engineering

(Chris Devlin) #1
aa

190 Chapter 5 / Transient and Steady-State Response Analyses

MATLAB Program 5–4


% ------------- Unit-step response -------------


% ***** Enter the numerator and denominator of the transfer


% function *****


num = [25];


den = [1 4 25];


% Enter the following step-response command


step(num,den)


% Enter grid and title of the plot


grid


title (' Unit-Step Response of G(s) = 25/(s^2+4s+25)')


1.4

1.2

1

0.8

0.6

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3
Time (sec)

Unit-Step Response of G(s)= 25/(s^2 + 4 s+25)

Amplitude

Figure 5–20
Unit-step response
curve.

Notice in Figure 5–20 (and many others) that the x-axis and y-axis labels are auto-


matically determined. If it is desired to label the xaxis and yaxis differently, we need


to modify the step command. For example, if it is desired to label the xaxis as 't Sec'


and the yaxis as ‘Output,’ then use step-response commands with left-hand arguments,


such as


c = step(num,den,t)


or, more generally,


[y,x,t] = step(num,den,t)


and use plot(t,y) command. See, for example, MATLAB Program 5–5 and Figure 5–21.


MATLAB Program 5–4 will yield a plot of the unit-step response of this system. A plot


of the unit-step response curve is shown in Figure 5–20.


Openmirrors.com

Free download pdf