OPTIMAL CONTROL State Space Representation Modeling and Analysis 2012/2013 José Sá da Costa Chapter 1 OPTIMAL CONTROL The aim of a control system is to force a given set of process variables to behave in some desired and prescribed way by either fulfilling some requirements of the time and frequency domain or achieving the best performances as expressed by an optimization index. Classical control system design is generally a trial‐and‐error process in which various methods of analysis are used iteratively to determine the design parameters of an "acceptable" system. Acceptable performance is generally defined in terms of time and frequency domain criteria such as rise time, settling time, peak overshoot, gain and phase margin, and bandwidth. José Sá da Costa Optimal Control 2 OPTIMAL CONTROL A radically different performance criteria must be satisfied, however, by the complex, multiple‐input, multiple‐output systems required to meet the demands of modern technology. For example, the design of a spacecraft attitude control system that minimizes fuel expenditure is not amenable to solution by classical methods. A new and direct approach to the synthesis of these complex systems, called optimal control theory, has been made feasible by the development of the digital computer. The objective of optimal control theory is to determine the control signals that will cause a process to satisfy the physical constraints and at the same time minimize (or maximize) some performance criterion. José Sá da Costa Optimal Control 3 State‐Space Representation: modeling and analysis Summary 1. State‐Space Representation: modeling and analysis 1.1 State‐Space Definitions 1.2 State‐Space Representation of Dynamic Systems 1.3 From State‐Space to Transfer Functions 1.4 Solution of the Time‐invariant State‐Space Equations 1.5 Solution of the Time‐variant State‐Space Equations 1.6 Discrete Time State‐Space 1.7 Controllability and Observability 1.8 Stability Analysis in State‐Space 1.9 Relevant MATLAB Functions for State‐Space Modelling and Analysis José Sá da Costa State‐Space Representation: summary 4 1. State‐Space Representation A nontrivial part of any control problem is modeling the system. The objective is to obtain the simplest mathematical description that adequately predicts the response of the physical system to all anticipated inputs. The classical control design approach uses the external mathematical representation of the process to synthetize the controller: the transfer function for the Single Input Single Output (SISO) case and the matrix transfer function for the Multiple Input, Multiple Output (MIMO) case. However, this external representation of the model does not give information about the internal state of the system neither is applicable to represent nonlinear systems. José Sá da Costa State‐Space Representation 5 1. State‐Space Representation The internal representation of the system dynamics can be made by means of the state space representation. The state‐space approach is a generalized time‐domain method for modeling, analyzing and designing a wide range of control systems and is particularly well suited to digital computational techniques. The approach can deal with • Multiple Input, Multiple Output (MIMO) systems, or multivariable systems • Non‐linear and time‐variant systems • Alternative controller design approaches, namely optimal control. Let us first introduce the basic definitions associated to state space representation. José Sá da Costa State‐Space Representation 6 1. State‐Space Representation , Modeling and Analysis 1.1 State‐Space Definitions 1.1.1 State 1.1.2 State variables 1.1.3 State vector 1.1.4 State‐space 1.1.5 State‐space equations José Sá da Costa State‐Space Representation Definitions 7 1.1 State‐Space Definitions State The state of a dynamical system is the smallest set of variables (called state variables) such that the knowledge of these variables at t t0 , together with the knowledge of the input for t t0 , completely determines the behavior of the system for any time t t0 . State variables The state variables of a dynamic system are the variables making up the smallest set of variables that determine the state of the dynamic system. If at least n variables x1 , x 2 , , xn , are needed to completely describe the behavior of a dynamical system, then such n variables are a set of state variables. José Sá da Costa State‐Space Representation Definitions 8 1.1 State‐Space Definitions State variables (cont.) State variables need not be physically measurable or observable quantities. However, it is convenient to choose meaningful or easily measurable quantities for the state variables, if this is possible at all, because state space and optimal control laws will require the feedback of all state variables. State vector If n state variables are needed to completely describe the behavior of a given system, then these n state variables can be considered the n components of a vector x. Such a vector is called a state vector. A state vector is thus a vector that determines uniquely the system state x(t) for any time t t0 , once the state at t t0 is given and the input u(t) for t t0 is specified. José Sá da Costa State‐Space Representation Definitions 9 1.1 State‐Space Definitions State‐space The n‐dimensional space whose coordinate axes consist of the x1 axis, x2 axis, . . . , xn, axis, where x1 , x2,. . . , xn, are state variables is called state‐space. Any state can be represented by a point in the state space. The manner in which the state variables change as a function of time may be thought of as a trajectory in n dimensional space, called the state‐space trajectory. Two‐dimensional state‐space is sometimes referred to as the phase‐ plane when one state is the derivative of the other. José Sá da Costa State‐Space Representation Definitions 10 1.1 State‐Space Definitions State‐space equations The dynamic system must involve elements that memorize the values of the input for t t0 . Since integrators (poles) in a continuous‐time system serve as memory devices, the outputs of such integrators can be considered as the variables that define the internal state of the dynamic system. The number of state variables to completely define the dynamics of the system is equal to the number of poles involved in the system. José Sá da Costa State‐Space Representation Definitions 11 1.1 State‐Space Definitions State‐space equations (cont.) Assume that a multiple‐input‐multiple‐output (MIMO) system involves: n states x1(t), x2(t), . . . , xn(t), r inputs u1(t), u2(t), . . . , ur(t) and m outputs y1(t), y2(t), .. . , ym(t). Then the system may be described by (1) José Sá da Costa State‐Space Representation Definitions 12 1.1 State‐Space Definitions State‐space equations (cont.) and (2) If we define José Sá da Costa State‐Space Representation Definitions 13 1.1 State‐Space Definitions State‐space equations (cont.) and and José Sá da Costa State‐Space Representation Definitions 14 1.1 State‐Space Definitions State‐space equations (cont.) Then eq.s (1) and (2) become x (t ) f (x, u, t ) y (t ) g (x, u, t ) state equation output equation (3) (4) Since f and/or g involve time t explicitly, then the system is a time‐ varying system. If eq.s (3) and (4) are linearized about the operating state, then we have the following linearized state equation and output equation: (5) x (t ) A(t )x(t ) B(t )u(t ) (6) y (t ) C(t )x(t ) D(t )u(t ) where A(t) is the state matrix, B(t) the input matrix, C(t) the output matrix, and D(t) the direct transmission matrix. José Sá da Costa State‐Space Representation Definitions 15 1.1 State‐Space Definitions State‐space equations (cont.) The block diagram representation of eq.s (5) and (6) is If vector functions f and g do not involve time t explicitly (time‐ invariant case) then the system is called a time‐invariant system. In this case, eq.s (5) and (6) can be simplified to x (t ) Ax(t ) Bu(t ) y (t ) Cx(t ) Du(t ) José Sá da Costa State‐Space Representation Definitions (7) (8) 16 1.1 State‐Space Definitions State‐space equations (cont.) where The coefficients aij, bij, cij, and dij are constants, some of which may be zero. José Sá da Costa State‐Space Representation Definitions 17 1.1 State‐Space Definitions State‐space equations (cont.) That corresponds to and José Sá da Costa State‐Space Representation Definitions 18 1.1 State‐Space Definitions State‐space equations (cont.) The block diagram representation for the time‐invariant case, eq.s (7) and (8), is Matrices A, B, C, and D are called the state matrix, input matrix (or control matrix), output matrix, and direct transmission matrix, respectively. José Sá da Costa State‐Space Representation Definitions 19 1.1 State‐Space Definitions In conclusion in a state‐space representation : A system is represented by a state equation and an output equation. For the Linear Time‐Invariant (LTI) case the internal structure of the system is described by a first‐order vector‐matrix differen‐ tial equation. This fact indicates that the state‐space representation is funda‐ mentally different from the transfer function representation, in which the dynamics of the system are described by the input and the output, but the internal structure is put in a black box. The nonlinear case can be linearized most of the times by Taylor's expansion around an equilibrium point José Sá da Costa State‐Space Representation Definitions 20 1. State‐Space Representation , Modeling and Analysis 1.2 State‐Space Representation of Dynamic Systems 1.2.1 State‐space modelling 1.2.2 Systems without derivative terms in the input 1.2.3 Systems with derivative terms in the input 1.2.4 State‐space realizations 1.2.4.1 Controllable canonical form 1.2.4.2 Observable canonical form 1.2.4.3 Observable canonical form 1.2.4.4 Diagonal canonical form 1.2.4.5 Jordan canonical form 1.2.4.6 Transformation of state‐space representation José Sá da Costa State‐Space Representation of Dynamic Systems 21 1.2 State Space Representation of Systems As stated before the dynamics of a system have elements that memorize the values of the input for t t0 . Mathematically speaking, integrators (poles) in a continuous‐time system serve as memory devices. The outputs of such integrators can be considered as the variables that define the internal state of the dynamic system. For a physical system energy storage elements retain the memory of the system. A possible choice of state variables is often those variables that represent energy storage. The number of state variables to completely define the dynamics of the system is equal to the number of poles (energy storages) involved in the system. José Sá da Costa State‐Space Representation of Dynamic Systems 22 1.2.1 State Space Modeling Choosing state variables of physical systems Linear Lumped Component Variable Electrical capacitor Voltage Electrical coil Current Spring Position (displacement) Mass (kinetic) Velocity Mass (potential) Position (elevation) Rotational inertia Angular velocity Rotational spring Rotational angle Thermal capacity Temperature Pressure vessel Pressure José Sá da Costa State‐Space Representation of Dynamic Systems 23 1.2.1 State‐Space Modeling Example Consider the mechanical system we assume linear. The external force u(t) is the input to the system and the displacement y(t) is the output. From the figure the system equation is It is a second order SISO system which means the system involves two states variables. Let us define Then we obtain José Sá da Costa State‐Space Representation of Dynamic Systems 24 1.2.1 State‐Space Modeling Example (cont.) or The output equation is In a vector‐matrix form, the state equations can be written as The output equation can be written as José Sá da Costa State‐Space Representation of Dynamic Systems 25 1.2.1 State‐Space Modeling Example (cont.) The previous equations are in the standard form where The corresponding block diagram is given by Note that the state varia‐ bles are the outputs of the integrators (storages) José Sá da Costa State‐Space Representation of Dynamic Systems 26 1.2.1 State‐Space Modeling Example Consider the mechanical system shown below. The displacements z1 and z2 are measured from the respective equilibrium positions of the carts before f is applied. The force is f = αu where u is a forcing func‐ tion (N). Assuming that m1 = 10 kg, m2 = 20 kg, b = 20 N‐s/m, k1 = 30 N/m, k2 = 60 N/m, and α = 10, and null initial conditions derive a state space representation of the system. José Sá da Costa State‐Space Representation of Dynamic Systems 27 1.2.1 State‐Space Modeling Example (cont.) From the second Newton’s law the equations of motion for this system are If we choose z1, ż1, z2, and ż2 as state variables (outputs of the energy storages) for the system and thus José Sá da Costa State‐Space Representation of Dynamic Systems 28 1.2.1 State‐Space Modeling Example (cont.) The previous dynamic equations can be rewritten as The state equation now becomes José Sá da Costa State‐Space Representation of Dynamic Systems 29 1.2.1 State‐Space Modeling Example (cont.) Assuming that z1 and z2 are the outputs of the system; hence, the output equations are In terms of vector‐matrix equations, we have the state space repre‐ sentation of the system, i.e. José Sá da Costa State‐Space Representation of Dynamic Systems 30 1.2.1 State‐Space Modeling Example (cont.) Next, we substitute the given numerical values of the parameters into the state equation. The result is José Sá da Costa State‐Space Representation of Dynamic Systems 31 1.2.1 State‐Space Modeling Example (cont.) Thus the state space matrices are Note that this system is a Single Input Multiple Output (SIMO) system since we have one input ( f ) and two outputs (z1 and z2). José Sá da Costa State‐Space Representation of Dynamic Systems 32 1.2.2 Systems without derivative terms in the input The two examples of the modeling of dynamic systems in state space form presented before are limited to the case where derivatives of the input functions do not appear explicitly in the equations of motion, i.e. no zeros in the model. However, in real cases sometimes we have systems with zeros and poles and the modeling of these systems in state space representation should be addressed in a different way. In the next section we deal with this case. The methodology followed before for the case that the system dynamics does not depend of derivative terms of the input (no zeros) can be generalize for a n order system as follows: José Sá da Costa State‐Space Representation of Dynamic Systems 33 1.2.2 Systems without derivative terms in the input Consider the following nth order system (9) Noting that the knowledge of , together with the input u(t) for t ³ 0 , determines completely the future behaviour of the system, we may take as a natural set of n state variables. Mathematically, this natural choice of state variables is quite convenient. Practically, however, because higher‐order derivative terms are inaccurate, due to the noise effects, such a choice of the state variables may not be desirable. José Sá da Costa State‐Space Representation of Dynamic Systems 34 1.2.2 Systems without derivative terms in the input Let us define Then eq. (9) can be written as José Sá da Costa State‐Space Representation of Dynamic Systems 35 1.2.2 Systems without derivative terms in the input or where x Ax Bu (10) The output can be given by José Sá da Costa State‐Space Representation of Dynamic Systems 36 1.2.2 Systems without derivative terms in the input or y Cx where (11) C = [1 0 0 ] Note that D is zero since the system is strictly proper. Note that the state‐space representation for the transfer function system is given also by eq.s (10) and (11). José Sá da Costa State‐Space Representation of Dynamic Systems 37 1.2.3 Systems with derivative terms in the input In this section, we take up the case where the equations of motion of a system involve one or more derivatives of the input function. In such a case, the variables that specify the initial conditions do not qualify as state variables. The main problem in defining the state variables is that they must be chosen such that they will eliminate the derivatives of the input function u in the state equation. Example Consider the mechanical system. The displacements y and u are measured from their respective positions. José Sá da Costa State‐Space Representation of Dynamic Systems 38 1.2.3 Systems with derivative terms in the input Example (cont.) The equation of motion for this system is or If we choose the state variables then we get José Sá da Costa State‐Space Representation of Dynamic Systems 39 1.2.3 Systems with derivative terms in the input Example (cont.) The right‐hand side of last equation involves the derivative term . Note that, in formulating state‐space representations of dynamic systems, we constrain the input function to be any function of time of order up to the impulse function, but not any higher order impulse functions, such as dδ(t)/dt, d2δ(t)/dt2, etc. To explain why the right‐hand side of the state equation should not involve the derivative of the input function u, suppose that u is the unit‐impulse function δ(t). Then the previous equation of ẋ2 by integration becomes José Sá da Costa State‐Space Representation of Dynamic Systems 40 1.2.3 Systems with derivative terms in the input Example (cont.) Notice that x2 (velocity) includes the term (k/m) δ(t). This means that x2(0) = ∞, which is not acceptable as a state variable. We should choose the state variables such that the state equation will not include the derivative of u. Suppose that we try to eliminate the term involving from the second state equation. One possible way to accomplish this is to define José Sá da Costa State‐Space Representation of Dynamic Systems 41 1.2.3 Systems with derivative terms in the input Example (cont.) Then Thus, the acceptable state equations can now be given by José Sá da Costa State‐Space Representation of Dynamic Systems 42 1.2.3 Systems with derivative terms in the input For the case where the dynamic equations involve , , , etc., the choice of state variables becomes more complicated. Fortunately, there are systematic methods for choosing state variables for a general case of equations of motion that involve derivatives of the input function u. In what follows we shall present one systematic method for elimi‐ nating derivatives of the input function from the state equations. Method Consider the differential equation system (12) Having in mind that the state variables must be such that they will eliminate the derivatives of u in the state equation. José Sá da Costa State‐Space Representation of Dynamic Systems 43 1.2.3 Systems with derivative terms in the input Method (cont.) One way to obtain a state equation and output equation is to define the following n variables as a set of n state variables: (13) José Sá da Costa State‐Space Representation of Dynamic Systems 44 1.2.3 Systems with derivative terms in the input Method (cont.) where b0 , b1 , b2 , , bn are determined from (14) With this choice of state variables the existence and uniqueness of the solution of the state equation is guaranteed. José Sá da Costa State‐Space Representation of Dynamic Systems 45 1.2.3 Systems with derivative terms in the input Method (cont.) Thus, the state equation and output equation can be given in terms of vector‐matrix equations by (15) José Sá da Costa State‐Space Representation of Dynamic Systems 46 1.2.3 Systems with derivative terms in the input Method (cont.) (16) Note that if β0 = bo = 0, then the state variable x1 is the output signal y, which can be measured, and, in this case, the state variable x2 is the output velocity ẏ minus b1u. Note that this is not the only choice of a set of state variables when you have input derivative terms. There are other methods to achieved adequate state space representation. José Sá da Costa State‐Space Representation of Dynamic Systems 47 1.2.4 State Space Realization Many techniques are available for obtaining state‐space representa‐ tions of transfer function (TF) of systems. In the previous section we present a few methods. However, there are some canonical forms that are convenient for control design. State‐space Representation in canonical forms Consider a system defined by (17) where u is the input and y is the output. This equation can also be written as (18) José Sá da Costa State‐Space Representation of Dynamic Systems 48 1.2.4 State Space Realization The following state‐space representation is called a controllable canonical form: (19) A in controllable companion form (ill conditioned) (20) José Sá da Costa State‐Space Representation of Dynamic Systems 49 1.2.4 State Space Realization The controllable canonical form is important in discussing the pole‐ placement approach to the control systems design. The following state space representation is called an observable canonical form (21) A in observable companion form (ill conditioned) Note that the n x n state matrix of the state equation given by eq. (21) is the transpose of that of the state equation defined by eq.(19). José Sá da Costa State‐Space Representation of Dynamic Systems 50 1.2.4 State Space Realization and (22) Diagonal canonical form Consider the transfer function system defined by eq. (18). For the distinct roots case, eq. (18) can be written as (23) José Sá da Costa State‐Space Representation of Dynamic Systems 51 1.2.4 State Space Realization The diagonal canonical form of the state‐space representation of this system is given by (24) (25) José Sá da Costa State‐Space Representation of Dynamic Systems 52 1.2.4 State Space Realization Jordan canonical form Next we shall consider the case where the denominator polynomial of eq. (18) involves multiple roots. For this case, the preceding diagonal canonical form must be modified into the Jordan canonical form. Suppose, for example, that the pi's are different from one another, except that the first three pi's are equal, or p1 = p2 = p3. Then the factored form of Y(s)/U(s) becomes The partial‐fraction expansion of this system in the Jordan canonical form is given by José Sá da Costa State‐Space Representation of Dynamic Systems 53 1.2.4 State Space Realization where Jordan block (26) (27) José Sá da Costa State‐Space Representation of Dynamic Systems 54 1.2.4 State Space Realization Example Consider the system given by Obtain state‐space representations in the controllable canonical form, observable canonical form, and diagonal canonical form. Resolution Controllable Canonical Form from eq.s (19) and (20) José Sá da Costa State‐Space Representation of Dynamic Systems 55 1.2.4 State Space Realization Example (cont.) Observable Canonical Form from eq.s (21) and (22) Diagonal Canonical Form from eq.s (24) and (25) José Sá da Costa State‐Space Representation of Dynamic Systems 56 1.2.4 State Space Realization Transformation of State Space Representation It has been stated that a set of state variables is not unique for a given system. Suppose that x1(t), x2(t), . . . , xn(t) are a set of state variables. Then we may take as another set of state variables any set of linear functions provided that, for every set of values 1(t), 2(t), . . . , n(t), there corresponds a unique set of values x1(t), x2(t), . . . , xn(t), and vice versa. José Sá da Costa State‐Space Representation of Dynamic Systems 57 1.2.4 State Space Realization Transformation of State Space Representation (cont.) Thus, if x is a state vector, then , where is also a state vector, provided the matrix P is nonsingular. The above result allow us to conclude that different state vectors convey the same information about the system behavior. Also, we conclude that is always possible by simple linear trans‐ formation to transform the state matrix A to a convenient form since the state vector transformation leads to the transformation of the state matrix to Note that the eigenvalues of A do not change by linear transforma‐ tion, thus the dynamics of the model remains the same after a similarity transformation. José Sá da Costa State‐Space Representation of Dynamic Systems 58 1.2.4 State Space Realization Transformation of State Space Representation (cont.) That is, a state space model (27) (28) can be transformed into another state space model by transforming the state vector x into state vector by means of the transformation where P is nonsingular. Then eq.s (27) and (28) can be written as or (29) (30) José Sá da Costa State‐Space Representation of Dynamic Systems 59 1.2.4 State Space Realization Transformation of State Space Representation (cont.) Equations (29) and (30) represent another state space model of the same system. Since infinitely many n x n nonsingular matrices can be used as a transformation matrix P, there are infinitely many state space models for a given system. Note that any state transformation leads to a different meaning for the transformed state. These results can be used to transform the system state space repre‐ sentation from one form to another, e.g. from a natural form to a controllable canonical form, or to a diagonal canonical form. José Sá da Costa State‐Space Representation of Dynamic Systems 60 1.2.4 State Space Realization Transformation of State Space Representation (cont.) Diagnolization of matrix A (n x n) Consider an n x n state matrix (31) with distinct eigenvalues λ1, λ2, . . ., λn. If the state vector x is transformed into another state vector z with the use of a transformation matrix P, or José Sá da Costa State‐Space Representation of Dynamic Systems 61 1.2.4 State Space Realization Transformation of State Space Representation (cont.) where (32) is known as the Vandermonde matrix. Then P-1AP becomes a diagonal matrix, or (33) José Sá da Costa State‐Space Representation of Dynamic Systems 62 1.2.4 State Space Realization Transformation of State Space Representation (cont.) If the matrix A defined by eq. (31) involves multiple eigenvalues, then diagonalization is impossible. For example, if the 3 X 3 matrix A has the eigenvalues λ1, λ1 and λ3, where λ1 ≠ λ3. In this case the transformation x = Sz, to diagonalize the matrix A is given by José Sá da Costa State‐Space Representation of Dynamic Systems 63 1.2.4 State Space Realization Transformation of State Space Representation (cont.) will yield which corresponds to the Jordan canonical form. José Sá da Costa State‐Space Representation of Dynamic Systems 64 1.2.4 State Space Realization Transformation of State Space Representation (cont.) Example Consider the following state‐space representation of a system where the states have a physical meaning (displacement, velocity and acceleration). a) Obtain the state‐space diagonal canonical form of the system. b) Conclude about the pros and cons of this representation regarding the initial one. José Sá da Costa State‐Space Representation of Dynamic Systems 65 1.2.4 State Space Realization Transformation of State Space Representation (cont.) Rewriting the model in a standard form (34) where The eigenvalues of A are the roots of the characteristic equation and the eigenvalues of A are λ1 =‒1, λ2 = ‒2, and λ3 =‒3. José Sá da Costa State‐Space Representation of Dynamic Systems 66 1.2.4 State Space Realization Transformation of State Space Representation (cont.) Thus, three eigenvalues are distinct. If we define a set of new state variables z1 , z2 , and z3 obtained by the Vandermonde transformation or (35) then, by substituting eq. (35) into eq. (34), we obtain José Sá da Costa State‐Space Representation of Dynamic Systems 67 1.2.4 State Space Realization Transformation of State Space Representation (cont.) By premultiplying both sides of this last equation by P-1, we get or Simplifying gives José Sá da Costa State‐Space Representation of Dynamic Systems 68 1.2.4 State Space Realization Transformation of State Space Representation (cont.) The output equation, eq. (34), is modified to y = CPz or b) The new states z do not have physical meaning since they result from the transformation x = Pz. This makes difficult the physical reasoning about this diagonal canonical form. José Sá da Costa State‐Space Representation of Dynamic Systems 69 1.2.4 State Space Realization , From Transfer Function to State Space in Matlab MATLAB is quite useful in transforming a system model from single input transfer function to state space and vice versa. Let us write the closed‐loop transfer function as Once we have this transfer function expression, the MATLAB com‐ mand allows to obtain the state space representation will give a state‐space representation. The MATLAB command gives one possible state‐space representation from infinity of possibilities. This command can be used when the system equation involves one or more derivatives of the input function. José Sá da Costa State‐Space Representation of Dynamic Systems 70 1.2.4 State Space Realization , From transfer function to state space in Matlab Example Consider the transfer‐function system From MATLAB command tf2ss results José Sá da Costa State‐Space Representation of Dynamic Systems 71 1.2.4 State Space Realization , From transfer function to state space in Matlab Example Consider the SIMO system 2s 3 s 2 2 s 1 G (s) 2 s 0.4 1 From MATLAB command tf2ss results x1 0.4 1.0 x1 1 u x 1.0 0 x2 0 2 2.0 3.0 x1 0 u y 1.6 0 x2 1 José Sá da Costa b = [0 2 3; 1 2 1]; a = [1 0.4 1]; [A,B,C,D] = tf2ss(b,a) A= ‐0.4000 ‐1.0000 1.0000 0 B= 1 0 C= 2.0000 3.0000 1.6000 0 D= 0 1 State‐Space Representation of Dynamic Systems 72 1. State Space Representation , Modeling and Analysis 1.3 From State‐Space to Transfer Functions 1.3.1 SISO systems 1.3.2 MIMO systems 1.3.3 From state‐space to transfer function in Matlab José Sá da Costa From State Space to Transfer Function 73 1.3.1 SISO systems , Derivation of transfer function of SISO system from state‐ space equations Let us consider the system whose transfer function is given by (36) This system may be represented in state space by the following equations: x (t ) Ax(t ) Bu(t ) y (t ) Cx(t ) Du(t ) (37) (38) where x is the state vector, u is the input, and y is the output. The Laplace transforms of eq.s (37) and (38) are given by (39) (40) José Sá da Costa From State Space to Transfer Function 74 1.3.1 SISO systems , Since the transfer function was previously defined as the ratio of the Laplace transform of the output to the Laplace transform of the input when the initial conditions were zero, we set x(0) in eq. (39) to be zero. Then we have or By pre‐multiplying obtain to both sides of this last equation, we (41) By substituting eq. (41) into eq. (40), we get (42) José Sá da Costa From State Space to Transfer Function 75 1.3.1 SISO systems , Upon comparing eq. (42) with eq. (36), we see that (43) This is the transfer function expression of the system in terms of A, B, C, and D. Note that the right‐hand side of eq. (43) involves (sI – A)-1. Hence G(s) can be written as where Q(s) is a polynomial in s. Therefore, |sI – A|-1 is equal to the characteristic polynomial of G(s). In other words, the eigenvalues of A are identical to the poles of G(s). José Sá da Costa From State Space to Transfer Function 76 1.3.1 SISO systems , Example Consider again the previous mechanical system. We saw that state‐space equations for the system are given by We shall obtain the transfer function for the system from these state‐space equations by using eq. (43). José Sá da Costa From State Space to Transfer Function 77 1.3.1 SISO systems , resulting Since José Sá da Costa From State Space to Transfer Function 78 1.3.1 SISO systems , we have which is the transfer function of the mechanical system. The same transfer function can be obtained applying directly the Laplace transform to the differential equation representing the model of the system, assuming initial conditions equal zero. José Sá da Costa From State Space to Transfer Function 79 1.3.2 MIMO systems , Derivation of transfer function of MIMO system from state‐ space equations Next, consider the multiple‐input‐multiple‐output (MIMO) system. Assume there are r inputs u1(t), u2(t), . . . , ur(t) and m outputs y1(t), y2(t), .. . , ym(t). Define The transfer matrix G(s) relates the output Y(s) to the input U(s), or where G(s) is given by José Sá da Costa From State Space to Transfer Function 80 1.3.3 From SS to TF in Matlab , To obtain the transfer function from state space equations, use the following MATLAB command iu must be specified for systems with more than one input. For exam‐ ple, if the system has three inputs (u1, u2, u3), then iu must be either 1,2, or 3, where 1 implies u1, 2 implies u2, and 3 implies u3. If the system has only one input, then either or may be used. José Sá da Costa From State Space to Transfer Function 81 1.3.3 From SS to TF in Matlab , Example Obtain the transfer function of the system defined by the following state‐space equations José Sá da Costa From State Space to Transfer Function 82 1.3.3 From SS to TF in Matlab , Example (cont.) From MATLAB program using command ss2tf the transfer function obtained is given by José Sá da Costa From State Space to Transfer Function 83 1.3.3 From SS to TF in Matlab , Example Consider a system with multiple inputs and multiple outputs This system involves two inputs and two outputs. Four transfer functions are involved: and . When considering input u1, we assume that input u2 is zero, and vice versa. José Sá da Costa From State Space to Transfer Function 84 1.3.3 From SS to TF in Matlab , Example José Sá da Costa (cont.) From State Space to Transfer Function 85 1.3.3 From SS to TF in Matlab , Example (cont.) Resulting the following four transfer functions: José Sá da Costa From State Space to Transfer Function 86 1.3.3 From SS to TF in Matlab , Note on MIMO systems To deal with the MIMO systems in Matlab it is easier to work with state space descriptors, since it is difficult to represent transfer function matrices as this requires 3D structures. To this end, to facilitate this dual representation, the following notation for a transfer function matrix of a system based on its state space matrices has been introduced A B G ( s ) C( sI A) B D C D 1 José Sá da Costa From State Space to Transfer Function 87 State Space Representation Problems Problem 1 Consider the spring‐mass‐dashpot system of the Figure. Assuming angle θ to be the output of the system, obtain the non‐linear and linear state‐space representation of the system. José Sá da Costa State Space Representation 88 State Space Representation Problems Problem 2 Consider the spring‐mass‐dashpot system mounted on a massless cart as shown in Figure. In this system, u(t) is the displacement of the cart and is the input to the system. At t = 0, the cart is moved at a constant speed. The displacement y(t) of the mass is the output. In this system, m denotes the mass, b denotes the viscous friction coefficient, and k denotes the spring constant. Assume the dashpot and spring have linear behavior. Obtain the following mathematical models of this system by assuming that the cart is standing still for t < 0 and the spring‐mass‐dashpot system on the cart is also standing still for t < 0: a) The natural state‐space representation of this system. b) The controllable canonical form of this system. c) The observable canonical form of this system. José Sá da Costa State Space Representation 89 1.2 State Space Representation of Systems , , Problem 3 Consider the transfer function system Y ( s) s U ( s ) ( s 10)( s 2 4 s 16) a) Verify if the state space representation below is a possible state‐space representation of the above transfer function. 1 0 x1 0 x1 0 x 0 x 1 u 0 1 2 2 x3 160 56 14 x3 14 x1 y 1 0 0 x2 0 u x3 b) Verify if the state‐space representation below is a possible state‐space representation of the above transfer function. x1 14 56 160 x1 1 x 1 x 0 u 0 0 2 2 x3 0 1 0 x3 0 x1 y 1 0 0 x2 0 u x3 c) Obtain the state‐space representation of the above transfer function using the MATLAB command tf2ss. Comment the result. José Sá da Costa State Space Representation 90 , State Space Representation Problems Problem 4 Consider the following state‐space representation of a system 1 0 x1 0 x1 0 x 0 x 0 u 0 1 2 2 x3 6 11 6 x3 6 x1 y 1 0 0 x2 x3 where the state variables have a physical meaning (displacement, velocity a and acceleration). a) Obtain the state‐space diagonal canonical form of the system. b) Conclude about the pros and cons of this representation regarding the initial one. José Sá da Costa State Space Representation 91 , State Space Representation Problems Problem 5 Consider the system given by 9 x 26 24 y 1 2 1 0 2 0 1 x 5 u 0 0 0 1 x a) Obtain the modal matrix b) Obtain the diagonal (modal) state‐space representation. Note: Modal matrix is the matrix that transforms a matrix A in to a diagonal matrix by similarity transformation. This matrix is made of the eigenvector associated with the eigenvectors of matrix A. José Sá da Costa State Space Representation 92 , State Space Representation Problems Problem 6 Consider the system given by 2 2 x 2 x ( d ) x u (t ) a) Obtain the state‐space representation of the system. b) Obtain the modal matrix. c) Obtain the modal state‐space representation José Sá da Costa State Space Representation 93 , State Space Representation Problems Problem 7 Consider the modal state‐space representation obtained in c) of Problem 6. a) Obtain the state‐space modal representation equivalent with only real parameters. b) Find the transformation matrix that directly transforms the state‐ space representation obtained in a) of Problem 6 to the representation obtained in a) of Problem 7. c) Generalize the transform obtained in b) for both complex and real eigenvalues. José Sá da Costa State Space Representation 94 , State Space Representation Problems Problem 8 a) Determine the transfer functions and draw a block diagram for the two‐input two –output system represented by 0 1 1 1 0 2 x x u, y x 2 3 0 2 1 0 b) Confirm the result using MATLAB. José Sá da Costa State Space Representation 95 , State Space Representation Problems Problem 9 a) Determine the state‐space modal representation of 4 s 2 15s 13 G(s) 2 s 3s 2 b) Confirm the result using MATLAB. José Sá da Costa State Space Representation 96 , State Space Representation Problems Problem 10 Consider the system represented in the block diagram. a) Calculate the state‐space equations. b) Determine the eigenvalues from the state equation. c) Find the equivalent transfer function. d) Verify if the system is controllable and / or observable. e) Calculate the modal matrix and the modal state‐space canonical form. f) Draw the block diagram of the modal canonical form obtained in e). José Sá da Costa State Space Representation 97 1. State Space Representation , Modeling and Analysis 1.4 Solution of the Time‐Invariant State‐Space Equations 1.4.1 Solution of homogeneous state equations 1.4.2 Solution of nonhomogeneous state equations 1.4.3 Useful results in vector‐matrix analysis 1.4.4 Response of Systems in State Space Form in Matlab José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 98 1.4 Solution of the Time‐Invariant State‐Space Equations , It is well known that the response of a linear time‐invariant system is given by the convolution integral independently of the adopted form of representation – transfer function or state‐ space. For the general case of a arbitrary input and initial conditions different of zero the system response is given by t x(t ) Φ(t )x(0) Φ( )Bu(t )d 0 (44) where Φ(t ) corresponds to a generalization of the impulse response (the unforced solution or the solution of the autono‐ mous system). For the SISO case we have the impulse response function and for the MIMO case we have the matrix of impulse response functions. José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 99 , 1.4.1 Solution of Homogeneous State Equations Before we solve vector‐matrix differential equations, let us review the solution of the scalar differential equation (45) In solving this equation, we may assume a solution x(t) of the form (46) By substituting this assumed solution into eq. (45), we obtain (47) If the assumed solution is to be the true solution, eq. (47) must hold for any t. José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 100 , 1.4.1 Solution of Homogeneous State Equations Hence, equating the coefficients of the equal powers of t, we obtain The value of b0 is determined by substituting t = 0 into eq. (46), or José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 101 , 1.4.1 Solution of Homogeneous State Equations Hence, the solution x(t) can be written as We shall now solve the vector‐matrix differential equation (48) By analogy with the scalar case, we assume that the solution is in the form of a vector power series in t, or (49) By substituting this assumed solution into eq. (48), we obtain (50) José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 102 , 1.4.1 Solution of Homogeneous State Equations Thus by equating the coefficients of like powers of t on both sides of eq. (50), we obtain By substituting t = 0 into eq. (49), we obtain José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 103 , 1.4.1 Solution of Homogeneous State Equations Thus, the solution x(t) can be written as The similarity of this equation to the infinite power series for a scalar exponential, we call it the matrix exponential and write In terms of the matrix exponential, the solution of eq. (48) can be written as (51) José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 104 , 1.4.1 Solution of Homogeneous State Equations Laplace transform approach Let us first consider the scalar case (52) Taking the Laplace transform of eq. (52), we obtain (53) Solving eq. (53) gives The inverse Laplace transform of this last equation gives the solution José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 105 , 1.4.1 Solution of Homogeneous State Equations Laplace transform approach (cont.) Extending this procedure to the homogeneous state equation case (54) Taking the Laplace transform of eq. (54), we obtain (55) Solving eq. (55) gives or premultiplying both sides of this last equation by (sI - A)-1, we obtain The inverse Laplace transform of this last equation gives the solution (56) José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 106 , 1.4.1 Solution of Homogeneous State Equations Laplace transform approach (cont.) Note that Hence, the inverse Laplace transform of (sI - A)-1 gives (57) Note: this is the closed solution for the matrix exponential. From eq.s (56) and (57), the solution of eq. (54) is obtained as or where the state‐transition matrix is (58) José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 107 , 1.4.1 Solution of Homogeneous State Equations Example Obtain the state‐transition matrix Φ(t) of the following system For this system, The state‐transition matrix Φ(t) is given by Since José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 108 , 1.4.1 Solution of Homogeneous State Equations Example (cont.) the inverse of (sI - A) is given by Hence José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 109 , 1.4.2 Solution of Nonhomogeneous State Equations Having address the homogeneous state equation solution case, for both the time domain approach and the Laplace transform approach, now we will concentrate in the Laplace transform to solve the nonhomogeneous state equation. To solve it in the time domain the procedure is analogous to the homogeneous case. Laplace transform approach Let us now consider the nonhomogeneous state equation described by (59) x = Ax + Bu where x = n‐vector u = r‐vector A = n x n constant matrix B = n x r constant matrix José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 110 , 1.4.2 Solution of Nonhomogeneous State Equations Laplace transform approach (cont.) The Laplace transform of this last equation (59) yields or Premultiplying both sides of this last equation by (sI - A)-1, we obtain Using the relationship given by eq. (53) gives The inverse Laplace transform of this last equation can be obtained by use of the convolution integral as follows: (60) José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 111 , 1.4.2 Solution of Nonhomogeneous State Equations Example Obtain the time response of the following system where u(t) is the unit‐step function occurring at t = 0, or u(t) = 1(t) For this system The state‐transition matrix Φ(t) = eAt was obtained in previous Example as José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 112 , 1.4.2 Solution of Nonhomogeneous State Equations Example (cont.) The response to the unit‐step input is then obtained as or If the initial state is zero, or x(0) = 0, then x(t) can be simplified to José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 113 , 1.4.2 Solution of Nonhomogeneous State Equations Solution in terms of x(t0) So far we have assumed the initial time to be zero. If, however, the initial time is given by t0 instead of t = 0, then the solution to eq. (54) must be modified to (61) ************************************************************************************** Next subsection will introduce several useful results in vector‐matrix analysis that will be useful to calculate the state‐transition matrix and the structural properties introduced in next section. ************************************************************************************** José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 114 , 1.4.3 Useful results in vector‐matrix analysis Matrix Exponential It can be proved that the matrix exponential of an n x n matrix A, k k ¥ 1 1 A t e At = I + At + A 2t 2 + + A k t k = å (63) 2! k! k =0 k ! converges absolutely for all finite t. Hence, computer calculations for evaluating the elements of e At by using the series expansion can be easily carried out. ¥ Ak t k Because of the convergence of the infinite series å , the series k =0 k ! can be differentiated term by term to give José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 115 , 1.4.3 Useful results in vector‐matrix analysis Matrix Exponential (cont.) The matrix exponential has the property that In particular, if s = t, then Thus, the inverse of e At is e-At . Since the inverse of e At always exists, e At is nonsingular. Note that José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 116 , 1.4.3 Useful results in vector‐matrix analysis State‐Transition Matrix Previously, we defined the state‐transition matrix as (64) For a given system this matrix is unique. Also, this matrix holds the properties of the matrix exponential Other relevant properties for LTI systems are José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 117 , 1.4.3 Useful results in vector‐matrix analysis State‐Transition Matrix (cont.) Has referred before the state‐transition matrix is unique and contains all information about the free motion of the system. If the eigenvalues λ1, λ2, . . ., λn of the matrix A are distinct, then Φ(t) will contain the n exponentials In particular, if the matrix A is diagonal, then José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 118 , 1.4.3 Useful results in vector‐matrix analysis State‐Transition Matrix (cont.) If there is a multiplicity in the eigenvalues, for example, if the eigenvalues of A are λ1, λ1, λ1, λ4, λ5, . . ., λn , then Φ(t) will contain, in addition to the exponentials terms like and . Cayley‐Hamilton Theorem This theorem is very useful in proving theorems involving matrix equations or solving problems involving matrix equations. Consider an n x n matrix A and its characteristic equation: José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 119 , 1.4.3 Useful results in vector‐matrix analysis Cayley‐Hamilton Theorem (cont.) The Cayley‐Hamilton theorem states that the matrix A satisfies its own characteristic equation, or that (65) The proof can be found in any algebra text book. Minimal Polynomial The characteristic equation is not, however, necessarily the scalar equation of least degree that A satisfies. The least‐degree polynomial having A as a root is called the minimal polynomial, i.e. the minimal polynomial of an n x n matrix A is defined as the polynomial ϕ(λ) of least degree, José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 120 , 1.4.3 Useful results in vector‐matrix analysis Minimal Polynomial (cont.) Such that ϕ(A) = 0 , or (66) The minimal polynomial plays an important role in the computation of polynomials in an n x n matrix. The minimal polynomial ϕ(λ) of an n x n matrix A can be determined by the following procedure: 1. Form adj(λI - A) and write the elements of adj(λI - A) as factored polynomials in λ. 2. Determine d(λ) as the greatest common divisor of all the elements of adj(λI - A). Choose the coefficient of the highest‐ degree term in λ of d(λ) to be 1. If there is no common divisor, d(λ) = 1. José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 121 , 1.4.3 Useful results in vector‐matrix analysis Minimal Polynomial (cont.) 3. The minimal polynomial ϕ(λ) is then given as |λI - A| divided by d(λ). Calculation of the Matrix exponential In solving control engineering problems, it often becomes necessary At to compute e . If matrix A is given with all elements in numerical values, MATLAB AT provides a simple way to compute e , where T is a constant, with the command “expm”. In other cases we need to calculate e At by analytical methods. José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 122 , 1.4.3 Useful results in vector‐matrix analysis Computation of e At : Method 1 If matrix A can be transformed into a diagonal form, then e At can be given by (67) where P is a diagonalizing matrix for A. If matrix A can be transformed into a Jordan canonical form, then e At can be given by (68) José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 123 , 1.4.3 Useful results in vector‐matrix analysis Computation of e At : Method 1. (cont.) Example Consider the following matrix A The characteristic equation is Thus, matrix A has a multiple eigenvalue of order 3 at λ = 1. It can be shown that matrix A has a multiple eigenvector of order 3. The transformation matrix that will transform matrix A into a Jordan canonical form can be given by José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 124 , 1.4.3 Useful results in vector‐matrix analysis Computation of e At : Method 1. (cont.) Example (cont.) The inverse of matrix S is Then it can be seen that José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 125 , 1.4.3 Useful results in vector‐matrix analysis Computation of e At : Method 1. (cont.) Example (cont.) ¥ Jkt k Jt e =å Noting that k =0 k ! (69) results Thus, we find José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 126 , 1.4.3 Useful results in vector‐matrix analysis Computation of e At : Method 2. The second method of computing e At uses the Laplace transform approach. Previously we had At Thus, to obtain e , first invert the matrix (sI ‒ A). This results in a matrix whose elements are rational functions of s. Then take the inverse Laplace transform of each element of the matrix. Example Consider the following matrix A José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 127 , 1.4.3 Useful results in vector‐matrix analysis Computation of e At : Method 2. (cont.) Example (cont.) The eigenvalues of A are 0 and 2. Since We obtain Hence José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 128 , 1.4.4 Response of Systems in SS Form in Matlab MATLAB can be used to obtaining response curves of systems that are written in state‐space form. To do so we first define the system with Step response For a unit‐step input, the MATLAB command or will generate plots of unit‐step responses. The time vector is automatically determined when t is not explicitly included in the step commands. José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 129 , 1.4.4 Response of Systems in SS Form in Matlab Note that when step commands have left‐hand arguments, such as no plot is shown on the screen. Hence, it is necessary to use a plot command to see the response curves. The matrices y and x contain the output and state response of the system, respectively, evaluated at the computation time points t. Matrix y has as many columns as outputs and one row for each element in t. Matrix x has as many columns as states and one row for each element in t. José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 130 , 1.4.4 Response of Systems in SS Form in Matlab Note also that: • the scalar iu is an index into the inputs of the system and specifies which input is to be used for the response; • t is the user‐specified time. • if the system involves multiple inputs and multiple outputs, the step commands produces a series of step response plots, one for each input and output combination of José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 131 , 1.4.4 Response of Systems in SS Form in Matlab Example Obtain the unit‐step response curves for the following system: Since this system involves two inputs and two outputs, we have four individual step‐ response curves. José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 132 , 1.4.4 Response of Systems in SS Form in Matlab José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 133 , 1.4.4 Response of Systems in SS Form in Matlab To plot two step‐response curves for the input u1 in one diagram and two step‐response curves for the input u2 in another diagram, we may use the commands and . José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 134 , 1.4.4 Response of Systems in SS Form in Matlab José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 135 , 1.4.4 Response of Systems in SS Form in Matlab Impulse response The unit‐impulse response of a dynamic system defined in a state space may be obtained with the use of one of the following MATLAB commands: Example Obtain the impulse response of the system given by the state‐space matrices José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 136 , 1.4.4 Response of Systems in SS Form in Matlab Program José Sá da Costa Impulse‐response curves Solution of the Time‐Invariant State ‐Space Equation 137 , 1.4.4 Response of Systems in SS Form in Matlab Response to arbitrary input The command lsim produces the response of linear time‐invariant systems to arbitrary inputs. If the initial conditions of the system in state‐space form are zero, then produces the response of the system to an arbitrary input u with user‐ specified time t. If the initial conditions are nonzero in a state‐space model, the command where x0 is the initial state, produces the response of the system, subject to the input u and the initial condition x0. To find the response to the initial condition x0 the previous command may be used where u is a vector consisting of zeros having length size(t), or the command José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 138 , 1.4.4 Response of Systems in SS Form in Matlab Example Plot the unit‐ramp response curve of the following system: José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 139 , 1.4.4 Response of Systems in SS Form in Matlab Example Obtain the response curves to initial condition of the following system: , José Sá da Costa with Solution of the Time‐Invariant State ‐Space Equation 140 , Response of Systems in State‐Space Form Problem 11 Consider the system represented by 0 6 0 x x u 1 5 1 a) Find the state transition matrix Φ(t)=exp [At] in the time domain space. b) Find the state transition matrix Φ (t)=exp [At] by using the frequency domain space. c) Confirm in MATLAB the result obtained for the transition matrix in a) and b). d) Solve the state equation for a unit step function scalar input u(t)=u‐1(t). a) Using MATLAB compute and plot the time response of d). José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 141 , Response of Systems in State‐Space Form Problem 12 Obtain the response y(t) of the following system where u(t) is the unit‐step input occurring at t = 0. José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 142 , Response of Systems in State‐Space Form Problem 13 Compute e At , where Problem 14 Consider the following matrix A Compute e At by three methods. José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 143 , Response of Systems in State‐Space Form Problem 15 Given the system equation find the solution in terms of the initial conditions x1(0), x2(0) and x3(0). Problem 16 Obtain a state‐space representation of the following system with MATLAB José Sá da Costa Solution of the Time‐Invariant State ‐Space Equation 144 1. State Space Representation , Modeling and Analysis 1.5 Solution of the Time‐variant State‐Space Equations José Sá da Costa Solution of the Time‐Variant State ‐Space Equation 145 , 1.5 Solution of Time‐Variant State‐Space Equation The state‐space form of a time‐variant system is given x (t ) A(t )x(t ) B(t )u(t ) x(0) x0 with y (t ) C(t )x(t ) D(t )u(t ) (70) Assume that the coefficient matrices in the above model are sufficiently well behaved for there to exist a unique solution to the state‐space model for any specified initial condition x(t0) and any integrable input u(t). For instance, if these coefficient matrices are piecewise continuous, with a finite number of discontinuities in any finite interval, then the desired existence and uniqueness properties hold. In this case for the general case of a arbitrary input and initial condi‐ tions different of zero the system response is unique given by t x(t ) Φ(t , t0 )x(t0 ) Φ(t , )B( )u(t )d 0 José Sá da Costa Solution of the Time‐Variant State ‐Space Equation (71) 146 , 1.5 Solution of Time‐Variant State‐Space Equation where the state‐transition matrix Φ(t , ) is unique. Unlike the time‐invariant case, we cannot define Φ as a simple exponential matrix. In fact, Φ can't be defined in general, because it will actually be a different function for every system. However, the state‐transition matrix does follow some basic properties that we can use to determine the state‐transition matrix. Φ holds the following proprieties (t , ) A(t )Φ(t , ) Φ (72) Φ( , ) I (73) and also Φ(t2 , t1 )Φ(t1 , t0 ) Φ(t2 , t0 ), Φ (t , )Φ(t , ) I, 1 José Sá da Costa Φ 1 (t , ) Φ( , t ), dΦ(t0 , t0 ) A(t ) dt Solution of the Time‐Variant State ‐Space Equation 147 , 1.5 Solution of Time‐Variant State‐Space Equation However, in the time‐variant case, there are many different functions that may satisfy these requirements, and the solution is dependent on the structure of the system since Φ has the general form (74) and the homogeneous solution is given by x(t ) Φ(t , t0 )x0 (75) There are several ways to calculate the state‐transition matrix. Here we will refer some of the must used approaches. José Sá da Costa Solution of the Time‐Variant State ‐Space Equation 148 , 1.5 Solution of Time‐Variant State‐Space Equation Method based on the Fundamental Matrix The solutions of the zero input case (homogeneous equation) (76) x (t ) A(t )x(t ) form an n‐dimensional vector space in the interval T = [t0, +∞[. Any set of n linearly‐independent solutions {x1, x2, ..., xn} to the homogeneous equation is called a fundamental set of solutions. The fundamental matrix is formed by creating a matrix out of the n fundamental vectors, i.e. Ψ(t ) x1 x 2 x3 x n This matrix will satisfy the state equation (t ) A(t )Ψ(t ) Ψ (77) Also, any matrix that solves this equation can be a fundamental matrix if and only if the determinant of the matrix is non‐zero for all time t in the interval T. José Sá da Costa Solution of the Time‐Variant State ‐Space Equation 149 , 1.5 Solution of Time‐Variant State‐Space Equation Once we have the fundamental matrix of a system, we can use it to find the state transition matrix of the system: Φ(t , t0 ) Ψ(t )Ψ 1 (t0 ) (78) Example Given the following fundamental matrix, find the state‐transition matrix. t 1 t e e Ψ(t ) 2 t 0 e From (77) results t e 1 Φ(t , t0 ) Ψ(t )Ψ (t0 ) 0 José Sá da Costa 1 t t0 e e 2 t e 0 1 3 t0 t t0 e e 2 t0 e 0 1 t t0 ( e e t 3 t0 ) 2 t t0 e Solution of the Time‐Variant State ‐Space Equation 150 , 1.5 Solution of Time‐Variant State‐Space Equation Method 2 If A(t) is triangular (upper or lower triangular), (79) then (80) The state transition matrix can be determined by sequentially integra‐ ting the individual rows of the state equation, starting from the third one José Sá da Costa Solution of the Time‐Variant State ‐Space Equation 151 , 1.5 Solution of Time‐Variant State‐Space Equation Method 3 If A(t) is diagonal (81) Then the state‐transition matrix is given by (82) José Sá da Costa Solution of the Time‐Variant State ‐Space Equation 152 , 1.5 Solution of Time‐Variant State‐Space Equation Method 4 If for every τ and t, the state matrix commutes as follows: t t A(t ) A( )d A( )d A(t ) t0 t0 Then the state‐transition matrix is given by (83) t Φ(t , t0 ) e t0 A ( ) d (84) Method 5 If A(t) can be decomposed as the following sum n A(t ) α i fi (t ) i 1 (85) where αi are constant matrices such that αiαj = αjαi and fi is a single‐ value function. José Sá da Costa Solution of the Time‐Variant State ‐Space Equation 153 , 1.5 Solution of Time‐Variant State‐Space Equation Method 5 (cont.) then the state‐transition matrix is given by n Φ(t , t0 ) e αi t t0 fi ( ) d i 1 (86) Example Calculate the state‐transition matrix for the system with the state matrix given by t 1 A(t ) 1 t We can decompose this matrix as 1 0 0 1 A (t ) t 1 0 1 1 0 José Sá da Costa Solution of the Time‐Variant State ‐Space Equation 154 , 1.5 Solution of Time‐Variant State‐Space Equation Example (cont.) Then the state‐transition matrix will be given by Φ(t , t0 ) e α1 t t0 f1 ( ) d α 2 e t t0 f2 ( ) d Solving the two integrations we obtain Φ(t , t0 ) e José Sá da Costa 2 2 0 0 1 ( t t0 ) 2 2 2 0 ( t t0 ) t t0 e t t0 0 Solution of the Time‐Variant State ‐Space Equation 155