Chapter 04

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 27

Chapter 04

Solving the State-


Equations
Group 2
Gealon, Brixston Bacon, Melfrans
Enriquez, Sheen Cabrera, Russel
Angob, John Rhodney
Powao, Christian Ian
Salvador, Rhyll Ven Clyde
4.1 Solutions of the Linear Time Invariant State
Equations

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:

Integrating both sides of Eq. (4.3) from to to f, we get

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

For the system in Example 4.7, compare the solutions obtained


using the MATLAB (CST) command Isim and the M-file march
when the initial condition is xO = [0.1; 0; 0; 0; 0; 0]r when the
elevator input, MI(f) is a rectangular pulse applied at t = 0 with
amplitude 0.05 rad. and duration 0.05 s, while the canard
input, u2(t), is a sawtooth pulse applied at t = 0 with amplitude
0.05 rad. and duration 0.05 s. The rectangular pulse and the
sawtooth pulse are defined in Examples 2.5 and 2.7,
respectively.
Mathematically, we can express the input vector as follows, using Eqs. (2.32) and (2.33):

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:

The resulting output, y(0, is plotted in Figure 4.11.


4.6 Numerical Solution of Nonlinear State-
Equation
The nonlinear state-equations are the most difficult to solve. As for time-varying systems, there is no analytical solution for a set of general
nonlinear state-equations. There are several numerical schemes available for solving a set of nonlinear, first-order differential equations using
the digital approximation to the continuous-time differential equations. Since the state-equations of a nonlinear system are also a set of
nonlinear, first-order differential equations, we can use such numerical schemes to solve the state-equations of nonlinear systems. Due to the
nonlinear nature of the differential equations, the solution procedure often is more complicated than merely marching forward in time, as we
did for linear systems in the previous two sections. Instead, an iterative solution procedure may be required at each time step, which means
that we assume a starting solution, and then go back and keep on changing the assumed solution until the solution converges (i.e. stops
changing appreciably with the steps of the iteration). A general set of nonlinear state-equations can be expressed as follows:
where x*(0 is a vector different from x(0, K is a constant, and |V| denotes a vector consisting of the absolute value of
each element of the vector V. For greater details on the existence of solution of ordinary nonlinear differential
equations see a textbook on ordinary differential equations, such as Henrici [4]. In this book, we will assume that we
are dealing with nonlinear system which have a solution to their state-equations. Owing to the nonlinear nature of
the differential equations, the numerical procedure cannot be a one-shot (i.e. an open-loop) process, such as that
used for linear differential equations. Instead, an iterative solution procedure is required for nonlinear systems, which
consists of repeatedly evaluating the solution in a loop (such as the feedback loop) at each time step, until the
solution meets certain desirable conditions. Hence, a nonlinear solution procedure itself is a closed-loop system.
Example
Consider a double-pendulum. A choice of the state variables for this fourth order system is xi(r) = 6\(t), x2(t) = 92(t), x3(t) = 0,(I)(f); x4(t) = 02\t),
which results in the following state-equations:

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.

You might also like