Chapter 04
Chapter 04
Chapter 04
where x(t) is the state variable, u(t) is the input, and a and b are the constant coefficients.
Equation (4. 1 ) represents a first order system. Let us try to solve this equation for t > ?o
with the initial condition, x(to) = XQ. (Note that since the differential equation, Eq. (4.1), is
of first order we need only one initial condition to obtain its solution). The solution to Eq.
(4.1) is obtained by multiplying both sides of the equation by exp{— a(t — to]} and re-
arranging the resulting equation as follows:
We recognize the term on the left-hand side of Eq. (4.2) as d/dt[exp{ — a(t — to)}x(t)], Therefore,
Eq. (4.2) can be written as:
Applying the initial condition, x(to) — XQ, and multiplying both sides of Eq. (4.4) by exp{a(t — to}}, we get
the following expression for the state variable, x(t):
Example
Consider a system with the following state-space coefficient matrices:
Let us solve the state-equations for t > 0 with the following initial condition:
The individual scalar state-equations can be expressed from Eq. (4.8) as follows:
where x\(t) and X2(t} are the state variables, and u(t) is the
input defined for t > 0. Since both Eqs. (4.11) and (4.12) are
decoupled, they are solved independently of one another, and
their solutions are given by Eq. (4.5) as follows:
4.2 Calculations of the State-Transition
Matrix
Using MATLAB, let us calculate the state-transition matrix for the system for /0 = 0 and t = 2 s. First, let
us use the command expmS as follows:
»A=[-1 2; -1 -3]; eAt = expm3(A*2)
eAt = 9.03246-003 3.3309e-002
-1.66546-002 -2.42766 -002
Now let us use the alternative approach with the command eig as follows:
»[V, D] = eig(A*2)
V=
8.16506-001 8.16506-001
-4.08256-001 +46--4. -001 -4.08256-0011
D=
-4.00006+000+ 2.00006+0001 0
0 -4.00006+000- 2.00006+0001
Then the state-transition matrix of the diagonalized system is calculated as follows:
»eD = exp(D) - rot90(eye(size(D)))
eD =
-7.62206-003+1.66546-0021
Finally, using the inverse state-transformation from the diagonalized system to the
original system, we get the state-transition matrix, eA/ , as follows:
»eAt = V*eD*inv(V)
eAt =
9.03246-003
4.3 Understanding the Stability Criteria through the State-Transition
Matrix
Equation (4.53) indicates that x(f) -> 0 as t -> oo. Thus, a system we know to be unstable from Example
4.4 (and from the third stability criterion), has an initial response decaying asymptotically to zero when
the initial condition is x(0) = [1: 0; 0 ]r , which is the characteristic of an asymptotically stable system.
Example 4.5 illustrates that we can be fooled into believing that a system is stable if we look at its initial
response to only some specific initial conditions. A true mirror of the system's stability is its state-
transition matrix, which reflects the three stability criteria. If any element of the state-transition matrix
grows to infinity as time becomes large, the system is unstable. Then it is possible to find at least one
initial condition that leads to an unbounded initial response. The state-transition matrix contains
information about how a system will respond to an arbitrary initial condition. Hence, the stability of a
system is deduced from all possible initial conditions (i.e. the state-transition matrix), rather than from
only some specific ones
4.4 Numerical Solution of Linear Time-Invariant through State-Equations
where us(t) and r(0 are the unit step and unit ramp functions, respectively. Using MATLAB, the
inputs are generated as follows:
Assuming that A, B, C, D, xO are already available in the MATLAB workspace from Example 4.7,
we can calculate the response of the system using march as follows:
where Yl is the returned output matrix for zero-order hold. For comparison, the solution is also
obtained using him and the output is stored in matrix Y2 as follows:
The computed outputs, y\ (0 and }>2(0, by the two different methods are compared in Figures
4.8 and 4.9, respectively. Note that the responses calculated using march with zero-order hold
and him are indistinguishable.
4.5 Numerical Solution of Linear Time-Varying through State-Equations
There is no general analytical procedure of solving the state-equations for linear timevarying
systems (i.e. when the state coefficient matrices, A,B,C,D, are functions of time). Thus, numerical
solution procedures using digital approximation methods, similar to those of the previous section,
are required for solving the state-equations of such systems. For special time-varying systems in
which the state-dynamics matrix, A, is a constant and the matrices B, C, and D are functions of time,
the analytical solution given by Eq. (4.27) is valid with the following modification:
where x(fo) is the initial condition and B(r) indicates the controls coefficient matrix evaluated at
time t = r. For linear, time-varying systems the output equation is given by:
Example
Consider the following linear, time-varying system:
Let us calculate the output, y(0, when the initial condition is x(0) = [0; — l]r and the input is a unit setp
function, u(t) = us(t). The time vector, initial condition, and input are specified by the following MATLAB
command:
The time- vary ing coefficient matrices are calculated by the M-file timv.m tabulated in Table 4.5. Then,
the solution to the time-varying state-equations and the output are obtained by calling vmarch.m as
follows:
where u(t) is the input torque applied on the mass, m2. Note that the last stateequation has a term involving x3 l \t) on
the right-hand side. This has been done for the sake of brevity (you can substitute x3 ] \t) from the previous state-
equation into the last state-equation to obtain the state-equations in explicit form). It is desired to obtain the solution
of Eq. (4.93) for the initial condition x(0) = [0.7 rad.; 1.4 rad.; 0 rad./s; 0 rad./s]r and input, u(t) = 0.01 sin(5r)W-m. The
function Mfile for evaluating the time derivative of the state-vector, x (1)(f), is called doub.m and is tabulated in Table
4.7. Note that the input, u(t), must be specified within the function file doub.m, while the initial condition is specified
4.7 Simulating Control System Response with Simulink Exercises
SIMULINK is very handy in quickly obtaining solutions to linear or nonlinear state equations resulting from
control systems with many sub-systems, using the ordinary differential equation solvers of MATLAB. SIMULINK
allows the representation of each system by a set of linear and nonlinear blocks, and lets inputs and outputs to
be modeled as special blocks called sources and sinks, respectively. A multivariable system can be represented
either using the individual transfer functions between scalar inputs and outputs, or more conveniently by state-
space model blocks. Copying the blocks from the SIMULINK block library makes simulating a control system very
easy. Refer to Appendix B, or SIMULINK User's Guide [7] for more information on SIMULINK. Since SIMULINK
works seamlessly with MATLAB and the Control System Toolbox (CST), you can draw upon the functions libraries
of MATLAB and CST (and any other toolboxes that you may happen to have on your computer). The default
simulation of SIMULINK uses the MATLAB function ode45, which is a fifth order, variable time-step Runge-Kutta
solver (see Section 4.6). This allows a simulation of both linear and nonlinear state-equations.
Let us simulate the step response of the flexible bomber aircraft (Example 4.7) using SIMULINK. The
SIMULINK block diagram and the resulting simulation are shown in Figure 4.20. Note the state-
space block modeling the aircraft dynamics, which requires that the state-coefficient matrices A, B,
C, D of the aircraft (Eq. (4.71)) be available in the MATLAB work-space. The source step input block
applies simultaneous unit step inputs, u\ (t) and u2(t), to the aircraft, and the resulting output
vector is split into its two scalar elements, y\(t ) (normal acceleration), and \'2(0 (pitch-rate), by a
demux block. The two simulated outputs are displayed individually on the scope blocks, as shown in
Figure 4.20. The simulation is run with default parameters (variable time-step ode45 solver with
relative error tolerance of 0.001 and absolute tolerance of 10~6 per element).
SIMULINK has many advanced features for simulating a complex control
system, such as the creation of new sub-system blocks and masking blocks
through M-files, C programs, or SIMULINK block diagrams, for effortless
integration in your system's model. This allows an extension of the
SIMULINK graphical functions to suit your own needs of analysis and
design. The SIMULINK demos and the User's Guide for SIMULINK [7] are
very helpful in explaining the advanced usage and extension of SIMULINK
block library.