### 2.25. OBTAINING THE TRANSIENT RESPONSE OF SYSTEMS USING MATLAB [6]

In the previous section, an algorithm (Eq. 2.248) was developed for obtaining the time response of a control system based on a knowledge of the **P** and **B** matrices, and a digital computer program was written in Fortran and applied to obtain the unit response for the control system illustrated in Figure 2.29. In this section, the relatively simple procedure for obtaining transient responses of control systems using MATLAB will be provided.

**Figure 2.35** Response of the system shown in Figure 2.29 to a unit step input for sampling times of 0.05–0.5 sec (*a*). and a comparison of the case of a 0.05-sec sampling time with the theoretical response (b).

The MATLAB commands, found in the *Control System Toolbox* and *The Student Edition* of MATLAB, for obtaining the unit step response of a control system are as follows:

(a) If the numerator (num) and denominator (den) of a closed-loop system are known in transfer function form:

step(num,den)

If the user wishes to supply the time *t* at which the step response will be computed at regularly spaced times, the following command is used:

step(num,den, *t*).

The time vector is automatically determined when *t* is excluded from the command.

As an illustration for obtaining the transient response ...