Chapter 9

State-Space Analysis of Systems

Chapter Objectives

  • Understand the concepts of a state variable and state-space representation of systems.
  • Learn the advantages of state-space modeling over other methods of representing continuous-time and discrete-time systems.
  • Learn to derive state-space models for CTLTI and DTLTI systems from the knowledge of other system descriptions such as system function, differential equation or difference equation.
  • Learn how to obtain a system function, a differential equation or a difference equation from the state-space model of a system.
  • Develop techniques for solving state-space models for determining the state variables and the output signal of a system.
  • Explore methods of converting a state-space model for a CTLTI system to that of a DTLTI system to allow simulation of CTLTI systems on a computer.

9.1 Introduction

In previous chapters of this text we have considered three different methods for describing a linear and time-invariant system:

  1. A linear constant-coefficient differential equation (or, in the case of a discrete-time system, a difference equation) involving the input and the output variables of the system in the time domain.
  2. A system function H (s) for a CTLTI system, or H (z) for a DTLTI system, describing the frequency-domain behavior characteristics of the system.
  3. An impulse response h (t) for a CTLTI system, or h [n] for a DTLTI system, that describes how the system responds to a continuous unit-impulse function δ (t) or a discrete-time unit-impulse function δ [n] as appropriate.

We know that these three descriptions are equivalent. For a continuous-time system, the system function H (s) can be obtained from the differential equation using Laplace transform techniques, specifically using the linearity and the differentiation-in-time properties of the Laplace transform. If the system under consideration is discrete, then the z-domain transfer function H (z) can be obtained from the governing difference equation in a similar manner, using the linearity and the time-shifting properties of the z-transform. Afterwards, the impulse response h (t) or h[n] can be determined from the appropriate system function using inverse transform techniques.

Alternatively, we may need to find the differential equation or the difference equation of a system specified through its impulse response. This can be achieved by simply reversing the order of steps described above. Thus, the three definition forms listed above for a linear and time-invariant system are interchangeable since we are able to go back and forth between them freely.

For signal-system interaction problems, that is, for problems involving the actions of a system on an input signal to produce an output signal, the solution of a general N-th order differential equation may be difficult or impossible to carry out analytically for anything other than fairly simple systems and input signals. Sometimes we can avoid the need to solve the differential equation, and attempt to solve the problem using frequency-domain techniques instead. This involves first translating the problem into the frequency domain, solving it in terms of transform-based descriptions of the signals and the systems involved, and finally translating the results back to the time domain. However, this approach only works for systems that have zero initial conditions, since the transfer function concept is valid for only CTLTI or DTLTI systems that are initially relaxed. Furthermore, if the system under consideration is nonlinear or time-varying or both, then the system function-based approach cannot be used at all, since system functions are only available for CTLTI or DTLTI systems.

In this chapter we will introduce yet another method for describing a system, namely state-space representation based on a set of variables called the state variables of the system.

Consider a continuous-time system that is originally described by means of a N-th order differential equation. A state-space model for such a system can be obtained by replacing the N-th order differential equation with N first-order differential equations that involve as many state variables and their derivatives. In general, the N first-order differential equations are coupled with each other, and must be solved together as a set rather than as individual equations.

Similarly, a discrete-time system that is described through a N-th order difference equation can be represented by N first-order difference equations using as many discrete-time state variables and their one-sample delayed versions.

As evident from the foregoing discussion, the state-space model of a system is a time-domain model rather than a frequency-domain one since it is derived from a differential equation or difference equation. State-space modeling of systems provides a number of advantages over other modeling techniques:

  1. State-space modeling provides a standard method of formulating the time-domain input-output relationship of a system independent of the order of the system.
  2. State-space model of a system describes the internal structure of the system, in contrast with the other description forms which simply describe the relationship between input and output signals.
  3. Systems with multiple inputs and/or outputs can be handled within the standard formulation we will develop in the rest of this chapter without the need to resort to special techniques that may be dependent on the topology of the system or on the number of input or output signals.
  4. State-space models for CTLTI and DTLTI systems are naturally suitable for use in computer simulation of these systems.
  5. State-space modeling also lends itself to the representation of nonlinear and/or time-varying systems, a task that is not achievable through modeling with the use of the system function or the impulse response. A N-th order differential equation or difference equation can be used for representing nonlinear and/or time-varying signals; however, computer solutions for these types of systems still necessitate the use of state-space modeling techniques.

In Section 9.2 we discuss state-space models for CTLTI systems. The discussion starts with the problem of obtaining a state-space model for a system described by means of a circuit diagram, differential equation or system function. Afterwards, methods for solving state equations are given. The problem of obtaining the system function from state equations is examined. The issue of system stability is studied from a state-space perspective. Section 9.3 repeats the topics of Section 9.2 for DTLTI systems. Conversion of the state-space model of a CTLTI system into that of an approximately equivalent DTLTI system for the purpose of simulation is the subject of Section 9.4.

9.2 State-Space Modeling of Continuous-Time Systems

Consider a single-input single-output continuous-time system described by a N-th order differential equation. Let r (t) and y (t) be the input and the output signals of the system respectively. Note that in this chapter we will change our notation a bit, and use r (t) for an input signal instead of the usual x (t). This change is needed in order to reserve the use of xi (t) for state variables as it is customary. The system under consideration can be thought of as a black box with input signal r (t), output signal y (t) and N internal variables xi (t) for i = 1,..., N as shown in Fig. 9.1.

Figure 9.1

Figure showing State-space representation of a system.

State-space representation of a system.

These internal variables are the state variables or, more compactly, the states of the system under consideration. The system can be described through a set of first-order differential equations written for each state variable:

dx1(t)dt=f1[ x1(t),...,xN(t),r(t) ]dx2(t)dt=f2[ x1(t),...,xN(t),r(t) ]     dxN(t)dt=fN[ x1(t),...,xN(t),r(t) ](9.1)

The first derivative of each state variable appears on the left side of each equation, and is set equal to some function fi [...] of all state variables and the input r (t). The equations given in Eqn. (9.1) are referred to as the state equations of the system. They describe how each state variable changes in the time domain in response to

  1. The input signal r (t)
  2. The current values of all state variables

In a sense, observing the time-domain behavior of the state variables provides us with information about the internal operation of the system. Once the N state equations are solved for the N state variables, the output signal can be found through the use of the output equation

y(t)=g[ x1(t),...,xN(t),r(t) ](9.2)

Eqns. (9.1) and (9.2) together form a state-space model for the system.

Up to this point in our discussion we focused on a system with a single input signal r (t) and a single output signal y (t). State-space models can be extended to systems with multiple input and/or output signals in a straightforward manner. Consider a system with K input signals {ri (t); i = 1,..., K} and M output signals {yj (t); i = 1,..., M} as shown in Fig. 9.2.

Figure 9.2

Figure showing State-space representation of a multiple-input multiple-output system.

State-space representation of a multiple-input multiple-output system.

The state equations given by Eqn. (9.1) can be modified as follows to represent this system through a state-space model:

dx1(t)dt=f1[ x1(t),...,xN(t),r1(t),...,rK(t) ]dx2(t)dt=f2[ x1(t),...,xN(t),r1(t),...,rK(t) ]       dxN(t)dt=fN[ x1(t),...,xN(t),r1(t),...,rK(t) ](9.3)

Each right-side function fi [...] becomes a function of all input signals as well as the state variables. In addition to this change, the output equation given by Eqn. (9.2) needs to be replaced with a set of output equations for computing all output signals:

y1(t)=g1[ x1(t),...,xN(t),r1(t),...,rK(t) ]y2(t)=g2[ x2(t),...,xN(t),r1(t),...,rK(t) ]     yM(t)=gM[ x1(t),...,xN(t),r1(t),...,rK(t) ](9.4)

Thus, the functions g1 [...], g2 [...], ..., gM [...] allow the output signals to be computed from the state variables and the input signals.

In most signal-system interaction problems our main focus is on the relationship between the input and the output signals of the system. Often we are faced with one of two types of questions:

  1. What is the output signal of a system in response to a specified input signal?
  2. What system produces a specified output signal for a specified input signal?

The first question represents an analysis perspective, and the second question represents a design perspective. Even though both questions are posed with a single-input single-output system in mind, they can easily be adapted to multiple-input multiple-output systems. In answering either question, the role of state variables is an intermediate one. We will see in later parts of this chapter that a given system can have multiple state-space models that are equivalent in terms of the input-output relationships they define. They would differ from each other, however, in terms of how they model the internal structure of the system.

In some state-space models, the state variables x1 (t), ..., xN (t) chosen correspond to actual physical signals within the system. In other models they may be purely mathematical variables that do not correspond to any physical signals. If we are in a situation where we need to understand the internal workings of a system, we may want to choose state variables that correspond to actual signals within the system. If, on the other hand, our focus is solely on the input-output relationship of the system, the role of state variables is intermediate. In such a case we would choose the state variables that lead to the simplest possible structure in the state equations given by Eqn. 9.1.

9.2.1 State-space models for CTLTI systems

The formulation given in Eqns. (9.1) through (9.4) was not based on any assumptions about the system under consideration. Therefore, it will apply to systems that do not necessarily have to be linear or time-invariant. If the continuous-time system is also linear and time-invariant (CTLTI), the right-side functions fi [...], i = 1, ..., N and gi [...], i = 1, ..., M are linear functions of the state variables and the input signals. For a single-input single-output CTLTI system, the state-space representation is in the form

dx1(t)dt=a11x1(t)+a12x2(t)+...+a1NxN(t)+b1r(t)dx2(t)dt=a21x1(t)+a22x2(t)+...+a2NxN(t)+b2r(t)      dxN(t)dt=aN1x1(t)+aN2x2(t)+...+aNNxN(t)+bNr(t)(9.5)

and the output equation is in the form

y(t)=c1x1(t)+c2x2+...,cNxN(t)+dr(t)(9.6)

Coefficients aij, bi, cj and d used in the state equations and the output equation are all constants independent of the time variable. Eqns. (9.5) and (9.6) can be expressed in matrix notation as follows:

State equation:x.(t)=Ax(t)+Br(t)(9.7)

Output equation:y(t)=Cx(t)+dr(t)(9.8)

The coefficient matrices used in Eqns. (9.7) and (9.8) are

A=[ a11a12...a1Na21a22...a2N   aN1aN2...aNN ],B[ b1b2bN ],C=[ c1c2cN ]T(9.9)

The vector x (t) is the state vector that consists of the N state variables:

x(t)=[ x1(t)x2(t)  xN(t) ](9.10)

The vector x.(t) contains the derivatives of the N state variables with respect to time:

x˙(t)=[ dx1(t)/dtdx2(t)/dtdxN(t)/dt ](9.11)

Thus, a single-input single-output CTLTI system can be uniquely described by specifying the matrix A, the vectors B and C, and the scalar d. If the initial value x (0) of the state vector is known, the state equation given by Eqn. (9.7) can be solved for x (t). Once x (t) is determined, the output signal can be found through the use of Eqn. (9.8).

Some authors use a variant of the state equation in place of Eqn. (9.7), and express x (t) as follows:

x˙(t)=Ax(t)+Br(t)+Edr(t)dt(9.12)

It can be shown (see Problem 9.2 at the end of this chapter) that this alternative form of the state equation can be converted into the standard form used in Eqn. (9.7) by the use of a linear transformation of the state vector, and therefore does not warrant separate analysis.

9.2.2 Obtaining state-space model from physical description

In this section we will present examples of obtaining a state-space model for a system starting with the physical relationships that exist between the signals within the system. The next two examples will illustrate this.

Example 9.1: State-space model for RLC circuit

Find a state-space model for the RLC circuit shown in Fig. 9.3 by choosing the inductor current and the capacitor voltage as the state variables.

Figure 9.3

Figure showing the RLC circuit for Example 9.1.

The RLC circuit for Example 9.1.

Solution: We will begin by writing KVL for the two loops:

-r(t)+R1i1(t)+υC(t)=0(9.13)

-υC(t)+υL(t)+R2i2(t)=0(9.14)

The voltage of an inductor is proportional to the derivative of its current:

υL(t)=Ldi2(t)dt=LdiL(t)dt(9.15)

The current of a capacitor is proportional to the derivative of its voltage; therefore, we have

i1(t)-i2(t)=Cdυc(t)dt

which can be solved for i1 (t) to yield

i1(t)=Cdυc(t)dt+i2(t)=Cdυc(t)dt+iL(t)(9.16)

Substituting Eqns. (9.15) and (9.16) into Eqns. (9.13) and (9.14) and rearranging terms we obtain

dυC(t)dt=-1R1CυC(t)-1CiL(t)+1R1Cr(t)(9.17)

diL(t)dt=1LυC(t)-R2LiL(t)(9.18)

The output signal is

y(t)=R2iL(t)(9.19)

Let the two state variables x1 (t) and x1 (t) be defined as

x1(t)=υC(t)andx2(t)=iL(t)

Using the state variables, the state equations are

dx1(t)dt=-1R1Cx1(t)-1Cx2(t)+1R1Cr(t)(9.20)

dx2(t)dt=1Lx1(t)-R2Lx2(t)(9.21)

and the output equation is

y(t)=R2x2(t)(9.22)

The state-space model in Eqns. (9.20) through (9.22) can be expressed in matrix form as

x˙(t)=[ -1/R1C-1/C1/L-R2/L ]x(t)+[ 1/R1C    0 ]r(t)

and

y(t)=[ 0R2 ]x(t)+(0)r(t)

With the substitution of the numerical values for circuit elements we get

x˙(t)=[ -2-2   1-5 ]x(t)+[ 10 ]r(t)

and

y(t)=[ 05 ]x(t)+(0)r(t)

Example 9.2: State-space model for series RLC circuit

Find a state-space model for the series RLC circuit shown in Fig. 9.4.

Figure 9.4

Figure showing the series RLC network for Example 9.2.

The series RLC network for Example 9.2.

Solution: Applying KVL to the circuit, we obtain

r(t)=RiL(t)+υL(t)+υC(t)(9.23)

Using the fundamental properties of the capacitor and the inductor we have

υL(t)=LdiL(t)dtandiL(t)=CdυC(t)dt

Using them with Eqn. (9.23) we get the two state equations:

diL(t)dt=-RLiL(t)-1LυC(t)+1Lr(t)

and

dυC(t)dt=1CiL(t)

The output voltage y (t) is obtained as

y(t)=-RiL(t)+r(t)

We will choose the inductor current and the capacitor voltage as the state variables of the system, so we have x1 (t) = iL (t), and x2 (t) = νC (t). The state equations are

dx1(t)dt=-RLx1(t)-1Lx2(t)+1Lr(t)(9.24)

dx2(t)dt=1Cx1(t)(9.25)

and the output equation is

y(t)=-Rx1(t)+r(t)(9.26)

The state equations and the output equation can be written in matrix form as

[ dx1(t)/dtdx2(t)/dt]=[ -R/L-1/L  1/C0 ][ x1(t)x2(t)]+[ 1/L  0]r(t)(9.27)

and

y(t)=[ -R0 ][ x1(t)x2(t)]+(1)r(t)(9.28)

Substituting the numerical values, Eqns. (9.27) and (9.28) become

x˙(t)=[ -2-126  0 ] x(t)+[ 10 ] r(t)

and

y(t)=[ -20 ]x(t)+(1)r(t)

9.2.3 Obtaining state-space model from differential equation

Converting a N-th order differential equation to a state-space model requires finding N first-order differential equations that represent the same system, and an output equation that links the output signal to the state variables. The solution is not unique. In this section we will present just one method of accomplishing this task. Consider a CTLTI system described by a differential equation in the form

dNy(t)dtN+aN-1dN-1y(t)dtN-1+...+a1dy(t)dt+a0y(t)=b0r(t)(9.29)

We will rewrite the differential equation so that the highest order derivative is computed from the remaining terms.

dNy(t)dtN=-aN-1dN-1y(t)dtN-1-...-a1dy(t)dt-a0y(t)+b0 r(t)(9.30)

Let us choose the state variables as follows:

x1(t)=y(t)x2(t)=dy(t)dtdx1(t)dt=x2(t)x3(t)=d2y(t)dt2dx2(t)dt=x3(t)         xN(t)=dN-1y(t)dtN-1dxN-1(t)dt=xN(t)

The resulting state equations are

dx1(t)dt=x2(t)dx2(t)dt=x3(t)dxN-1(t)dt=xN(t)dxN(t)dt=-a0x1(t)-a1x2(t)-...-aN-1xN(t)+b0r(t)        (9.31)

The last state equation is obtained by using the state variables x1 (t) through xN (t) defined above in the differential equation given by Eqn. (9.30), and writing dxN (t)/dt in terms of the state variables x1 (t) through xN (t) and the input signal r (t). The output equation is easily found from the assignment of the first state variable:

y(t)=x1(t)(9.32)

In matrix form, the state-space model is

x˙(t)=Ax(t)+Br(t)y(t)=Cx(t)+dr(t)

with

A=[ 0100...00010...00001...0...0000...1-a0-a1-a2-a3...-aN-1 ],B=[ 0000b0 ](9.33)

for the state equation, and

C=[ 100...00 ],d=0(9.34)

for the output equation. This form of the state-space model is called the phase-variable canonical form. It has special significance in the study of control systems. Pay attention to the structure of the coefficient matrix A, repeated below in partitioned form:

image

The top left partition is a (N − 1) × 1 vector of zeros; the top right partition is an identity matrix of order (N − 1); the bottom row is a vector of differential equation coefficients in reverse order and with a sign change. This is handy for obtaining the state-space model by directly inspecting the differential equation. It is important to remember, however, that the coefficient of the highest order derivative in Eqn. (9.29) must be equal to unity for this to work.

Example 9.3: State-space model from differential equation

Find a state-space model for a CTLTI system described by the differential equation

d3y(t)dt3+5d2y(t)dt2+11dy(t)dt+15y(t)=3r(t)

Solution: Expressing the highest order derivative as a function of the other terms leads to

d3y(t)dt3=-5d2y(t)dt2-11dy(t)dt-15y(t)+3r(t)(9.36)

State variables can be defined as

x1(t)=y(t)x2(t)=dy(t)dtx2(t)=dx1(t)dtx3(t)=d2y(t)dt2x3(t)=dx2(t)dt

Recognizing that

d3y(t)dt3=dx3(t)dt

the differential equation in Eqn. (9.36) can be written as

dx3(t)dt=-5x3(t)-11x2(t)-15x1(t)+3r(t)

In matrix form, the state-space model is

x˙(t)=[ 010001-15-11-5 ] x(t)+[ 003 ] r(t)y(t)=[ 100 ] x(t)

Example 9.4: State-space model from differential equation revisited

Find a state-space model for a CTLTI system described by the differential equation

d3y(t)dt3+5d2y(t)dt2+11dy(t)dt+15y(t)=3r(t)+7dr(t)dt

Solution: This differential equation is similar to that of Example 9.3 except for the derivative of the input signal that appears on the right side of the equal sign. While it is possible to use the alternative form of state equation suggested by Eqn. (9.12) for this system, we will choose to stay with the standard form of Eqn. (9.7). Let us first rewrite the differential equation in a rearranged form.

d3y(t)dt3-7dr(t)dt=-5d2y(t)dt2-11dy(t)dt-15y(t)+3r(t)(9.37)

State variables will be defined as

x1(t)=y(t)x2(t)=dy(t)dtx2(t)-dx1(t)dtx3(t)=d2y(t)dt2-7r(t)x3(t)=dx2(t)dt-7r(t)

We have defined the last state variable x3 (t) differently from the definition in Example 9.3 so that the left side of Eqn. (9.37) is equal to the derivative of x3 (t). Using these definitions, Eqn. (9.37) becomes

dx3(t)dt=-5[ x3(t)+7r(t)-11x2(t)-15x1(t)+3r(t) ]

In matrix form, the state-space model is

x˙(t)=[ 010001-15-11-5 ] x(t)+[ 07-32 ] r(t)y(t)=[ 100 ] x(t)

When we compare Examples 9.3 and 9.4 we see that coefficient matrix A is the same in both of them, but the vector B is different. The inspection method for deriving the state-space model directly from the differential equation would not be as straightforward to use when we have derivatives of the input signal appearing on the right side. We will, however, generalize the relationship between the coefficients of the differential equation and the state-space model when we consider the derivation of the latter from the system function in the next section.

9.2.4 Obtaining state-space model from system function

If the CTLTI system under consideration has a system function that is simple in the sense that it has no multiple poles and all of its poles are real-valued, then a state-space model can be easily found using partial fraction expansion. This idea will be explored in the next example.

Example 9.5: State-space model from s-domain system function

It can be shown that the RLC circuit that was used in Example 9.1 and shown in Fig. 9.3 has the system function

G(s)=Y(s)R(s)=10(s+3)(s+4)

Find an alternative, but equivalent, state-space model for the system based on this system function.

Solution: Expanding the system function into partial fractions and then solving for the transform Y (s) we get

Y(s)=10s+3R(s)-10s+4R(s)

Let us define Z1 (s) and Z2 (s) as

Z1(s)=10s+3R(s)(9.38)

and

Z2(s)=-10s+4R(s)(9.39)

so that Y (s) = Z1 (s) + Z2 (s). Rearranging the terms in Eqns. (9.38) and (9.39) we get

sZ1(s)=-3Z1(s)+10R(s)(9.40)

and similarly

sZ2(s)=-4Z2(s)-10R(s)(9.41)

Taking the inverse Laplace transform of Eqns. (9.40) and (9.41) leads to the two first-order differential equations

dz1(t)dt=-3z1(t)+10r(t)(9.42)

dz2(t)dt=-4z2(t)-10r(t)(9.43)

Using z1 (t) and z2 (t) as the new state variables, the state-space model can be written as

[ dz1(t)/dtdz2(t)/dt]=[ -300-4 ][ z1(t)z2(t)]+[ 10-10 ]r(t)

and

y(t)=[ 11 ][ z1(t)z2(t)]

Example 9.5 was made simple by the fact that the partial fraction expansion of the system function contains only first-order terms with real coefficients. An interesting consequence of the simple technique utilized is that the state equations obtained in Eqns. (9.42) and (9.43) are uncoupled, that is, each state equation involves only one of the state variables. This corresponds to a diagonal coefficient matrix A. Consequently, we have the advantage of being able to solve the state equations independently of each other.

If the system function does not have the properties that allowed the simple solution of Example 9.5, finding a state-space model for a system function involves the use of a block diagram as an intermediate step. The development of this idea will be presented using a third-order system function as an example; generalization to higher-order system functions will be readily apparent. Consider the system function

G(s)=Y(s)X(s)=b3s3+b2s2+b1s+b0s3+a2s2+a1s+a0(9.44)

Using the techniques discussed in Section 7.6.1 of Chapter 7, the simulation diagram shown in Fig. 9.5 can be obtained for G (s).

Figure 9.5

Figure showing Simulation diagram for G (s) of Eqn. (9.44).

Simulation diagram for G (s) of Eqn. (9.44).

We know from integration property of the Laplace transform (see Section 7.3.8 of Chapter 7) that multiplying a transform by 1/s is equivalent to integrating the corresponding signal in the time domain. Therefore, a time-domain equivalent of the block diagram in Fig. 9.5 can be obtained by replacing 1/s components with integrators and using time-domain versions of input and output quantities. The resulting diagram is shown in Fig. 9.6.

Figure 9.6

Figure showing Selecting states from the simulation diagram for G (s).

Selecting states from the simulation diagram for G (s).

A state-space model can be obtained from the diagram of Fig. 9.4 as follows:

  1. Designate the output signal of each integrator as a state variable. These are marked in Fig. 9.6 as x1 (t), x2 (t) and x3 (t).
  2. The input of each integrator becomes the derivative of the corresponding state variable. These are marked in Fig. 9.6 as dx1/dt, dx2/dt and dx3/dt.
  3. Express the signal at the input of each integrator as a function of state variables and the input signal r (t) as dictated by the diagram.

Following state equations are obtained by inspecting the diagram in Fig. 9.6:

dx1(t)dt=x2(t)(9.45)

dx2(t)dt=x3(t)(9.46)

dx3(t)dt=-a0x1(t)-a1x2(t)-a0x3(t)+r(t)(9.47)

The output signal can be written as

y(t)=b0x1(t)+b1x2(t)+b2x3(t)+b3dx3(t)dt(9.48)

We do not like to see the derivative of a state variable on the right side of the output equation. Substituting Eqn. (9.47 into Eqn. (9.48) yields the proper form of the output equation

y(t)=(b0-b3a0)x1(t)+(b1-b3a1)x2(t)+(b2-b3a2)x3(t)+b3r(t)(9.49)

Expressed in matrix form, the state-space model is

x˙(t)=[ 010001-a0-a1-a2 ] x(t)+[ 001 ] r(t)(9.50)

y(t)=[ (b0-b3a0)(b1-b3a1)(b2-b3a2) ]x(t)+b3r(t)(9.51)

The results can easily be extended to a N-th order system function in the form

G(s)=Y(s)X(s)=bNSN+bN-1sN-1+...+b1s+b0sN+aN-1sN-1+...+a1s+a0(9.52)

to produce the state-space model

x˙(t)=[ 0100...00010...00001...0...0000...1-a0-a1-a2-a3...-aN-1 ] x(t)+[ 00001 ] r(t)(9.53)

y(t)=[ (b0-bNa0)(b1-bNa1)...(bN-2-bNaN-2)(bN-1-bNaN-1) ]x(t)+bNr(t)(9.54)

It is interesting to see that the structure of the coefficient matrix A is the same as in Eqn. (9.35). Similarly, the vector B is identical to that found in Section 9.2.3.

Software resources:

See MATLAB Exercise 9.1.

Example 9.6: State-space model from block diagram

Find a state-space model for a CTLTI system described through the system function

G(s)=2s3-26s+24s4+7s3+21s2+37s+30

Solution: A block diagram for this system was constructed in Example 7.40 of Chapter 7, and was shown in Fig. 7.69. That diagram is shown again in Fig. 9.7 with notation adapted to time domain and with the designations of the four state variables marked.

Figure 9.7

Figure showing Block diagram for Example 9.6.

Block diagram for Example 9.6.

The state equations are

dx1(t)dt=x2(t)dx2(t)dt=x3(t)dx3(t)dt=x4(t)dx4(4)dt=-30x1(t)-37x2(t)-21x3(t)-7x4(t)+r(t)

and the output equation is

y(t)=24x1(t)-26x2(t)+2x4(t)

In matrix form we get

x˙(t)=[ 010000100001-30-37-21-7 ] x(t)+[ 0001 ]r(t)

and

y(t)=[ 24-2602 ]x(t)

Example 9.7: State-space model from block diagram revisited

Find a state-space model for a CTLTI system with the system function

G(s)=2s3-26s+24s4+7s3+21s2+37s+30

using the cascade form block diagram.

Solution: A cascade form block diagram for this system was constructed in Example 7.41 of Chapter 7, and was shown in Fig. 7.72. That diagram is shown again in Fig. 9.8 with notation adapted to time domain and with the designations of the four state variables marked.

Figure 9.8

Figure showing Block diagram for Example 9.7.

Block diagram for Example 9.7.

Writing the input signal of each integrator in terms of the other signals in the diagram we obtain

dx1(t)dt=x2(t)(9.55)

dx2(t)dt=-5x1(t)-2x2(t)-x3(t)+dx3(t)dt(9.56)

dx3(t)dt=-2x3(t)-3x4(t)+dx4(t)dt(9.57)

dx4(t)dt=-3x4(t)+r(t)(9.58)

and the output signal is

y(t)=8x1(t)+2x2(t)

State equations should not contain any derivatives on the right side of the equal sign. Using Eqn. (9.58) in Eqn. (9.57) yields

dx3(t)dt=-2x3(t)-6x4(t)+r(t)(9.59)

Similarly, using Eqn. (9.59) in Eqn. (9.56) we get

dx2(t)dt=-5x1(t)-2x2(t)-3x3(t)-6x4(t)+r(t)(9.60)

The state-space model can now be put in matrix form using Eqns. (9.55), (9.58), (9.59) and (9.60). The result is

x˙(t)=[ 0100-5-2-3-600-2-6000-3 ] x(t)+[ 0111 ] r(t)

and

y(t)=[ 8200 ]x(t)

9.2.5 Alternative state-space models

In Examples 9.1 and 9.2 we have defined the state variables of each system as the capacitor voltage and the inductor current. These choices were mainly motivated by the fact that the derivatives of these two quantities readily appear in KVL equations for either circuit.

Other state variables could have been defined for these systems as well, leading to alternative state-space models. Consider a CTLTI system defined through Eqns. (9.7) and (9.8). Let z (t) be a length-N column vector of variables z1 (t),..., zN (t), related to the original state vector x (t) of the CTLTI system through

x(t)=Pz(t)(9.61)

where P is a constant N × N transformation matrix. The only requirement on the matrix P is that it be non-singular (invertible). Substituting Eqn. (9.61) into Eqn. (9.7) leads to

Pz˙(t)=APz(t)+Br(t)(9.62)

Multiplication of both sides of Eqn. (9.62) with the inverse of P from the left yields

z˙(t)=P-1APz(t)+P-1Br(t)(9.63)

Finally, using Eqn. (9.61) with Eqn. (9.8) we get

y(t)=CPz(t)+dr(t)(9.64)

Eqns. (9.63) and (9.64) provide us with an alternative state-space model for the same CTLTI system, using a new state vector z (t). They can be written in the standard form of Eqns. (9.7) and (9.8) as

z˙(t)=A˜z(t)+B˜r(t)(9.65)

y(t)=C˜z(t)+dr(t)(9.66)

with newly defined coefficient matrices

A˜=P-1AP(9.67)

B˜=P-1B(9.68)

and

C˜=CP(9.69)

The transformation relationship A˜=P-1AP is known in control system theory as a similarity transformation. It can be used for obtaining alternative state-space models of a system. Each choice of the transformation matrix P leads to a different, but equivalent, state-space model. In each of these alternative models the input-output relationship remains the same although the state variables are different. Since any non-singular matrix P can be used in a similarity transformation, an infinite number of different state-space models can be found for a given system.

Software resources:

See MATLAB Exercise 9.2.

In the next several examples we will explore this concept further.

Example 9.8: Alternative state-space model for series RLC circuit

Refer to the system in Example 9.2 again. Since the system is of second order, the input-output relationship can be expressed through a second-order differential equation between y (t) and r (t). Find such a differential equation from the state-space model found in Example 9.2. Afterwards obtain an alternative state-space model for the same system directly from the second-order differential equation.

Solution: The state-space model found in Example 9.2 was

x˙(t)=[ -2-1260 ]x(t)+[ 10 ]r(t)

and

y(t)=[ -20 ]x(t)+r(t)

If we write the state equations and the output equation in open form, we obtain

dx1(t)dt=-2x1(t)-x2(t)+r(t)(9.70)

dx2(t)dt=26x1(t)(9.71)

y(t)=-2x1(t)+r(t)(9.72)

Let us differentiate Eqn. (9.72) to obtain

dy(t)dt=-2dx1(t)dt+dr(t)dt(9.73)

Substituting Eqn. (9.70) into Eqn. (9.73)

dy(t)dt=4x1(t)+2x2(t)-2r(t)+dr(t)dt(9.74)

Differentiating Eqn. (9.74) one more time and using the result with Eqns. (9.70) and (9.71) leads to

d2y(t)dt2=44x1(t)-4x2(t)+4r(t)-2dr(t)dt+d2r(t)dt2(9.75)

Finally, eliminating the state variables x1 (t) and x2 (t) between Eqns. (9.72), (9.74) and (9.75) yields the second-order differential equation

d2y(t)dt2=-2dy(t)dt-26y(t)+d2r(t)dt2+26r(t)(9.76)

A state-space model in phase-variable canonical form can be obtained from the differential equation in Eqn. (9.76) using the technique discussed in Section 9.2.4. The result is

z˙(t)=[ 01-26-2 ] z(t)+[ 01 ] r(t)y(t)=[ 0-2 ] z(t)+r(t)

Software resources:

ex_9_8.m

Example 9.9: State variable transformation

Show that the alternative state-space model found in Example 9.8 could have been obtained from the state-space model of Example 9.2 through the transformation

x(t)=Pz(t)=[ 01260 ]z(t)

Solution: The original state-space model found in Example 9.1 has the coefficient matrices

A=[ -2-1260 ],B=[ 10 ],C=[ -20 ],d=1

The inverse of the transformation matrix P specified above is

P-1=[ 01/2610 ]

Applying the similarity transformation given by Eqn. (9.67) to the coefficient matrix A yields

A˜=P-1AP=[ 01/2610 ][ -2-1260 ][ 01260 ]=[ 01-26-2 ]

which is identical to the matrix A˜ found in Example 9.8. Vectors B˜ and C˜ can also be found using Eqns. (9.68) and (9.69) as

B˜=P-1B=[ 01/2610 ][ 10 ]=[ 01 ]

and

C˜=CP=[ -20 ][ 01260 ]=[ 0-2 ]

Vectors B˜ and C˜ also agree with those found in Example 9.8.

Software resources:

ex_9_9.m

9.2.6 CTLTI systems with multiple inputs and/or outputs

A CTLTI system with multiple input and/or output signals can also be represented with a state-space model in the standard form of Eqns. (9.7 and (9.8). Consider a CTLTI system with K input signals {ri (t); i = 1,..., K} and M output signals {yj (t); i = 1,..., M}. Let r (t) be the K × 1 vector of input signals:

r(t)=[ r1(t)r2(t)rK(t) ](9.77)

Similarly, y (t) is the M × 1 vector of output signals.

y(t)=[ y1(t)y2(t)yM(t) ](9.78)

With these new vectors, the state equation is in the form

x˙(t)=A x(t)+B r(t)(9.79)

The matrix A is still the N × N coefficient matrix, and the vector x (t) is still the N × 1 state vector as before. Dimensions of the matrix B will need to be changed, however, to make it compatible with the K × 1 vector r (t). Therefore, B is now a N × K matrix. The output equation is in the form

y(t)=Cx(t)+Dr(t)(9.80)

Dimensions of C need to be updated as well. Since y (t) is a M × 1 vector, C is a M × N matrix. Additionally, the scalar d in the output equation in Eqn. (9.8) is replaced with a M × K matrix D.

Example 9.10: Multiple-input multiple-output system

Consider a CTLTI system with two inputs and two outputs that is described by a pair of differential equations:

d2y1(t)dt2+3dy1(t)dt+2y1(t)+y2(t)=3r1(t)+r2(t)dy2(t)dt+3y2(t)+4y1(t)=r1(t)+4dr1(t)dt-2r2(t)

Find a state-space model for this system.

Solution: We will begin by rearranging the terms of the two differential equations to obtain

d2y1(t)dt2=-3dy1(t)dt-2y1(t)-y2(t)+3r1(t)+r2(t)(9.81)

dy2(t)dt-4dr1(t)dt=-3y2(t)-4y1(t)+r1(t)-2r2(t)(9.82)

Let us define the state variables as follows:

x1(t)=y1(t),x2(t)=dy1(t)dt,x3(t)=y2(t)-4r1(t)(9.83)

It naturally follows that

dx1(t)dt=x2(t)(9.84)

Using the definitions of the state variables in Eqns. (9.83) and (9.84) we obtain

dx2(t)dt=-3x2(t)-2x1(t)-[ x3(t)+4r1(t) ]+3r1(t)+r2(t)=-2x1(t)-3x2(t)-x3(t)-r1(t)+r2(t)(9.85)

and

dx3(t)dt=-3[ x3(t)+4r1(t) ]-4x1(t)+r1(t)-2r2(t)=-4x1(t)-3x3(t)-11r1(t)-2r2(t)(9.86)

Eqns. (9.84), (9.85) and (9.86) can be put in matrix form as

x˙(t)=[ 010-2-3-1-403 ] x(t)+[ 00-11-11-2 ] r(t)

and

y(t)=[ 100001 ]x(t)+[ 0004 ]r(t)

9.2.7 Solution of state-space model

Before deriving the general solution for the state-space model of a continuous-time system it will be useful to consider a special case in which the coefficient matrix A is upper-triangular, that is, all of its elements below the main diagonal are equal to zero. Example 9.11 will demonstrate that a step-by-step solution can be obtained in this case.

Example 9.11: Solving state equations with upper-triangular coefficient matrix

A system is described by the state-space model

x˙(t)=[ -3100-2500-1 ] x(t)+[ 021 ] r(t)

and

y(t)=[ 100 ]x(t)

The initial value of the state vector is

x(0)=[ 032 ]

Determine the output signal in response to a unit-step input signal.

Solution: The differential equation for the state variable x3 (t) does not include either of the other two state variables; therefore, it is convenient to start with it.

dx3(t)dt=-x3(t)+r(t)=-x3(t)+u(t),x3(0)=2(9.87)

Let us apply the solution technique developed in Section 2.5.1 of Chapter 2. Using Eqn. (2.57) with α = 1 and t0 = 0, the solution of Eqn. (9.87) is

x3(t)=e-tx3(0)+0te-(t-τ)u(τ)dτ,t0

Using the initial value x3 (0) = 2 and realizing that u (τ) = 1 within the integration interval we obtain

x3(t)=2e-t+0te-(t-τ)dτ=(1+e-t)u(t)(9.88)

Having determined x3 (t), the differential equation for x2(t) is

dx2(t)dt=-2x2(t)+5x3(t)+2r(t)=-2x2(t)+5(1+e-t)u(t)+2u(t)=-2x2(t)+(7+5e-t)u(t),       x2(0)=3(9.89)

Repeating the procedure outlined above,x2 (t) is determined as

x2(t)=3e-2t+0te-2(t-τ)(7+5e-τ)u(τ)dτ=(72+5e-t-112e-2t)u(t)(9.90)

Finally, the differential equation for x1 (t) is

dx1(t)dt=-3x1(t)+x2(t)=-3x1(t)+(72+5e-t-112e-2t)u(t),     x1(0)=0(9.91)

which can be solved to yield

x1(t)=(76+52e-t-112e-2t+116e-3t)u(t)

The output of the system is found using the output equation:

y(t)=x1(t)=(76+52e-t-112e-2t+116e-3t)u(t)

The solution of Example 9.11 was made simple by the fact that the coefficient matrix is upper-triangular. Starting with the last state equation and working our way up we were able to resolve the dependencies between state equations one at a time. Next, we will develop a general solution method that does not rely on an upper-triangular coefficient matrix. The solution will be obtained in two steps: First, the solution of the homogeneous state equation will be found. Next, a particular solution will be found based on the input signal r (t). The complete solution of the state equation is obtained as the sum of the homogeneous solution and the particular solution. The derivation of the solution procedure should be compared to the development in Section 2.5.2 of Chapter 2 for an ordinary differential equation.

Homogeneous Solution: Consider the homogeneous state equation obtained by setting r (t) = 0:

x˙(t)=x(t)(9.92)

Each of the state variables xi (t) in the state vector x (t) can be expressed by a Taylor series in the form

xi(t)=xi(0)+dxi(t)dt|t=0t+12!d2xi(t)dt2|t=0t2+...+1n!dnxi(t)dtn|t=0tn+...(9.93)

Alternatively, Eqn. (9.93) can be generalized to construct a vector form of Taylor series for expressing the state vector x (t) as

x(t)=x(0)+dx(t)dt|t=0t+12!d2x(t)dt2|t=0t2+...+1n!dnx(t)dtn|t=0tn+...(9.94)

Each vector derivative in Eqn. (9.94) corresponds to a vector of corresponding derivatives of all state variables:

dnx(t)dtn|t=0=[ dnx1(t)/dtndnx2(t)/dtndnxN(t)/dtn ]t=0(9.95)

Using the homogeneous state equation, the first derivative evaluated at t = 0 is

dx(t)dt|t=0=Ax(t)|t=0=Ax(0)(9.96)

The second derivative of the state vector evaluated at time t = 0 is obtained by differentiating both sides of Eqn. (9.92) and using it in conjunction with Eqn. (9.96):

d2x(t)dt2|t=0=Adx(t)dt|t=0=A(Ax(0))=A2x(0)(9.97)

Continuing in this fashion, the n-th derivative of the state vector evaluated at t = 0 is

dnx(t)dtn|t=0=Anx(0)(9.98)

Using Eqn. (9.98), the Taylor series expansion given by Eqn. (9.94) for the state vector becomes

x(t)=[ I+At+12!A2t2+...+1n!Antn+... ]x(0)(9.99)

In Eqn. (9.99) the infinite series in square brackets is the matrix exponential function eAt, that is,

eA t=I+At+12!A2t2+...+1n!Antn+...(9.100)

Therefore, the homogeneous solution of the state equation is

x(t)=eAtx(0)(9.101)

As in the case of scalar differential equations, the homogeneous solution represents the behavior of the state variables of the system due to the initial conditions alone. In the absence of an external input signal r (t) the matrix eAt transforms the state vector at time t = 0 to the state vector at time t. Consequently it is referred to as the state transition matrix. A method for computing the state transition matrix of a state-space model will be presented in Section 9.2.8.

State transition matrix:

ϕ(t)=eAt(9.102)

General Solution: The general solution technique for the state equation will parallel the development of the general solution for a first-order differential equation in Section 2.5.1 of Chapter 2. Consider the non-homogeneous state equation

x˙(t)=x(t)+B r(t)(9.103)

with the initial state of the system specified at time t = t0.

We will begin with an assumed solution in the form

x(t)=eAts(t)(9.104)

where s (t) is a yet undetermined column vector of time functions s1 (t),..., sN (t). Differentiation of both sides of Eqn. (9.104) with respect to time results in

x˙(t)=A eAts(t)+eA ts˙(t)(9.105)

Comparing Eqns. (9.105) and (9.103) leads us to the conclusion

B r(t)=eA ts˙(t)(9.106)

Solving Eqn. (9.106) for s˙(t) yields

s˙(t)=e-A tB r(t)(9.107)

Integrating both sides of Eqn. (9.107) over time starting at t = t0 we obtain

s(t)=s(t0)+t0te-A τB r(τ) dτ(9.108)

Substituting Eqn. (9.108) into Eqn. (9.104) results in

x(t)=eA ts(t0)+eA tt0te-AτBr(τ)dτ(9.109)

The term s (t0) is obtained from Eqn. (9.104) as

s(t0)=e-A t0x(t0)(9.110)

and Eqn. (9.109) becomes

x(t)=eA(t-t0)x(t0)+t0teA(t-τ)Br(τ)dτ(9.111)

The state equation

x.(t)=Ax(t)+Br(t),x(t0):specified(9.112)

is solved as

x(t)=eA(tt0)x(t0)+t0teA(tτ)Br(τ)dτ(9.113)

Often the initial state of a system is specified at time instant t = 0. In that case the general solution becomes

x(t)=eA tx(0)+0teA(t-τ)r(τ)dτ(9.114)

9.2.8 Computation of the state transition matrix

In the previous section it became apparent that the state transition matrix plays an important role in solving the state equations. The definition of the state transition matrix ϕ (t) is based on the infinite series

ϕ(t)=eA t=I+A t+12!A2t2+...+1n!Antn+...

While the series is convergent, and can be used for approximating ϕ (t) for specific values of t, we still need a method for determining the analytical form of ϕ (t). Such a method will be presented in this section.

We will begin with the homogeneous state equation given by Eqn. (9.92) and take the unilateral Laplace transform of each side of it to obtain

sX(s)-x(0)=AX(s)(9.115)

The vector X (s) is a column vector of Laplace transforms of state variables, that is,

X(s)=[ X1(s)X2(s)XN(s) ]

Rearranging terms of Eqn. (9.115) we get

[ sI-A ]X(s)=x(0)(9.116)

The matrix I in Eqn. (9.116) represents the identity matrix or order N. Its inclusion is necessary to keep the two terms in square brackets dimensionally compatible, since we could not subtract a matrix from a scalar. Solving Eqn. (9.116) for X (s) results in

X(s)=[ sI-A ]-1x(0)(9.117)

The state vector can be found by taking inverse Laplace transform of Eqn. (9.117) as

x(t)=-1{ [ s I-A ]-1 }x(0)(9.118)

The state transition matrix ϕ (t) is found by comparing Eqns. (9.118) and (9.101):

ϕ(t)=-1{ [ s I-A ]-1 }(9.119)

The matrix

Φ(s)=[ sI-A ]-1(9.120)

is called the resolvent matrix , and is the Laplace transform of the state transition matrix.

In summary, computation of the state transition matrix involves the following steps:

  1. Form the matrix [s IA].
  2. Find the resolvent matrix Φ (s) by inverting the matrix [s IA].
  3. Find the state transition matrix ϕ (t) by computing the inverse Laplace transform of Φ (s).

Example 9.12: Finding the state transition matrix

Determine the state transition matrix ϕ (t) for a system with the coefficient matrix

A=[ -1-1010-157-6 ]

The first step is to construct the matrix [s IA]:

[ sI-A ]=s[ 100010001 ]-[ -1-1010-157-6 ]=[ s+110-1s1-5-7s+6 ]

In the next step we find the resolvent matrix Φ (s):

Φ(s)=[ sI-A ]-1=1det[ sI-A ]adj[ sI-A ]=[ s2+6s+7(s+1)(s+2)(s+4)-s-6(s+1)(s+2)(s+4)1(s+1)(s+2)(s+4)1(s+2)(s+4)s+6(s+2)(s+4)-1(s+2)(s+4)5s+7(s+1)(s+2)(s+4)7s+2(s+1)(s+2)(s+4)s2+s+1(s+1)(s+2)(s+4) ]

The state transition matrix ϕ (t) is found by taking the inverse Laplace term of each element of the resolvent matrix using partial fraction expansion.

ϕ(t)=[ (23e-t+12e-2t-16e-4t)(-53e-t+2e-2t-13e-4t)(13e-t-12e-2t+16e-4t)(12e-2t-12e-4t)(2e-2t-e-4t)(-12e-2t+12e-4t)(23e-t+32e-2t-136e-4t)(-53e-t+6e-2t-133e-4t)(13e-t-32e-2t+136e-4t) ]

Example 9.13: Solving state equations for RLC circuit

A state-space model for the RLC circuit in Fig. 9.3 was found in Example 9.1 as

x˙(t)=[ -2-21-5 ] x(t)+[ 10 ] r(t)y(t)=[ 05 ] x(t)

The initial value of the state vector is

x(0)=[ 3-2 ]

Compute the two state variables x1 (t) and x2 (t) as well as the output signal y (t) in response to a unit-step input signal.

Solution: We will begin by constructing the matrix [s IA]:

[ sI-A ]=s[ 1001 ]-[ -2-21-5 ]=[ s+22-1s+5 ]

The resolvent matrix Φ (s) is the inverse of [s IA]:

Φ(s)=[ sI-A ]-1=[ s+5(s+3)(s+4)-2(s+3)(s+4)1(s+3)(s+4)s+2(s+3)(s+4) ]

State transition matrix φ (t) is found by taking the inverse Laplace transform of each element of the resolvent matrix through partial fraction expansion:

ϕ(t)=-1{ Φ(s) }=[ (2e-3t-e-4t)(-2e-3t+2e-4t)(e-3t-e-4t)(-e-3t+2e-4t) ]

The state vector x (t) can now be computed through the use of Eqn. (9.114). The first term in the solution is the homogeneous solution which is

ϕ(t)x(0)=[ (2e-3t-e-4t)(-2e-3t+2e-4t)(e-3t-e-4t)(-e-3t+2e-4t) ][ 3-2 ]=[ 10e-3t-7e-4t5e-3t-7e-4t ]

In preparation for the computation of the second term in Eqn. (9.114), which is the particular solution, we first need to compute

ϕ(t)B=[ (2e-3t-e-4t)(-2e-3t+2e-4t)(e-3t-e-4t)(-e-3t+2e-4t) ][ 10 ]=[ 2e-3t-e-4te-3t-e-4t ]

The particular solution is

0tϕ(t-τ)Br(τ)dτ=0t[ 2e-3(t-τ)-e-4(4-τ)e-3(t-τ)-e-4(t-τ) ] dτ=[ 512-23e-3t+14e-4t112-13e-3t+14e-4t ]

The state vector is obtained by adding the homogeneous and particular solutions:

x(t)=[ 10e-3t-7e-4t5e-3t-7e-4t ]+[ 512-23e-3t+14e-4t112-13e-3t+14e-4t ]=[ 512+283e-3t-274e-4t112+143e-3t-274e-4t ]

and the output signal is obtained through the use of the output equation:

Software resources:

ex_9_13.m

Software resources:

See MATLAB Exercises 9.3, 9.4 and 9.5.

9.2.9 Obtaining system function from state-space model

The problem of obtaining a state-space model of a CTLTI system from its s-domain system function was considered in Section 9.2.4. In this section we will discuss the inverse problem. Given a state-space model for a CTLTI system, determine the system function G (s).

Initially we will focus on a single-input single-output system. Let the system be defined by a state-space model in the standard form of Eqns. (9.7) and (9.8). Taking the Laplace transform of both sides of the state equation yields

sX(s)=A X(s)+B R(s)(9.121)

X (s) is a column vector that holds the Laplace transform of each state variable:

X(s)=[ X1(s)X2(s)XN(s) ]

In taking the Laplace transform of the state equation we have assumed zero initial conditions, that is,

x(0)=0(9.122)

since the system is CTLTI. Recall that the system function concept is only valid for a linear and time-invariant system. Rearranging terms of Eqn. (9.121) yields

(sI-A)X(s)=B R(s)(9.123)

The N × N identity matrix I is necessary to keep the two terms in parentheses compatible. Solving Eqn. (9.124) for X (s) we obtain

X(s)=(sI-A)-1B R(s)(9.124)

Next we will take the Laplace transform of the output equation and then use Eqn. (9.124) in it to obtain

Y(s)=CX(s)+d R(s)=C(sI-A)-1B R(s)+d R(s)=[C(sI-A)-1B+d] R(s)(9.125)

The system function is found from Eqn. (9.125) as

G(s)=Y(s)R(s)=C(sI-A)-1B+d(9.126)

We recognize the term (s IA)−1 in Eqn. (9.126) as the resolvent matrix Φ (s). Therefore

G(s)=CΦ(s)+B+d(9.127)

Example 9.14: Obtaining the system function

Determine the system function for a CTLTI system described by the state-space model

x˙(t)=[ -2-21-5 ] x(t)+[ 10 ] r(t)y(t)=[ 05 ] x(t)

Solution: For the specified coefficient matrix A, the resolvent matrix was determined in Example 9.13 as

Φ(s)=[ sI-A ]-1=[ s+5(s+3)(s+4)-2(s+3)(s+4)1(s+3)(s+4)s+2(s+3)(s+4) ]

Using Eqn. (9.127) the system function is

G(s)=CΦ(s)B+d=[ 05 ][ s+5(s+3)(s+4)-2(s+3)(s+4)1(s+3)(s+4)s+2(s+3)(s+4) ][ 10 ]=5(s+3)(s+4)

Software resources:

See MATLAB Exercises 9.6.

The results obtained for a single-input single-output system can easily be adapted to multiple input multiple-output systems. Consider a CTLTI system with K input signals {ri (t); i = 1,..., K} and M output signals {yj (t);i = 1,..., M}. The matrix B is (N × K), and the matrix C is (M × N). The scalar d turns into a matrix D that is (M × K). As a result, Eqn. (9.127) turns into

G(s)=CΦ(s)B+D(9.128)

G(s) is a (M × K) matrix of system functions from each input to each output.

[ Y1(s)Y2(s)YM(s) ]=[ G11(s)G12(s)...G1K(s)G21(s)G22(s)...G2K(s)         GM1(s)GM2(s)...GMK(s) ][ R1(s)R2(s)RK(s) ](9.129)

Example 9.15: System function for multiple-input multiple-output system

A 2-input 2-output system is characterized by the state-space model

x˙(t)=[ 010-2-3-1-40-3 ] x(t)+[ 00-11-11-2 ] r(t)y(t)=[ 100001 ] x(t)+[ 0004 ] r(t)

Determine the system function matrix G (s).

Solution: We will begin by constructing the matrix [s IA].

[ sI-A ]=s[ 100010001 ]-[ 010-2-3-1-40-3 ]=[ s-102s+3140s+3 ](9.130)

The state transition matrix is found by inverting [s IA].

Φ(s)=[ sI-A ]-1=1s3+6s2+11s+2[ (s+3)2(s+3)-1-2(s+1)s(s+3)-s-4(s+3)-4(s+1)(s+2) ]

The system function matrix is

G(s)=CΦ(s)B+D=1s3+6s2+11s+2[ -(s-8)(s+5)-(11s2+33s+18)2s(2s2+11s+19) ]

Software resources:

ex_9_15.m

9.3 State-Space Modeling of Discrete-Time Systems

Discrete-time systems can also be modeled using state variables. Consider a discrete-time system with a single input signal r [n] and a single output signal y [n]. Such a system can be modeled by means of the relationships between its input and output signals as well as N internal variables xi[n] for i = 1,..., N as shown in Fig. 9.9.

Figure 9.9

Figure showing State-space representation of a discrete-time system.

State-space representation of a discrete-time system.

The internal variables x1[n],..., xN [n] are the state variables of the discrete-time system. Let us describe the system through a set of first-order difference equations written for each state variable:

x1[ n+1 ]=f1(x1[ n ],...,xN[ n ],r[ n ])x2[ n+1 ]=f2(x1[ n ],...,xN[ n ],r[ n ])            xN[ n+1 ]=fN(x1[ n ],...,xN[ n ],r[ n ])(9.131)

The equations given in Eqn. (9.131) are the state equations of the system. They describe how each state variable changes in the time domain in response to

  1. The input signal r [n]
  2. The current values of all state variables

Observing the time-domain behavior of the state variables provides us with information about the internal operation of the system. Once the N state equations are solved for the N state variables, the output signal can be found through the use of the output equation

y[ n ]=g(x1[ n ],...,xN[ n ],r[ n ])(9.132)

Eqns. (9.131) and (9.132) together form a state-space model for the system.

Systems with multiple inputs and/or outputs can be represented with state-space models as well. Consider a discrete-time system with K input signals {ri[n]; i = 1,..., K} and M output signals {yj[n]; i = 1,..., M} as shown in Fig. 9.10.

Figure 9.10

Figure showing State-space representation of a multiple-input multiple-output discrete-time system.

State-space representation of a multiple-input multiple-output discrete-time system.

The state equations given by Eqn. (9.131) can be modified to apply to a multiple-input multiple-output system through a state-space model in the form

x1[ n+1 ]=f1(x1[ n ],...,xN[ n ],r1[ n ],...,rK[ n ])x2[ n+1 ]=f2(x1[ n ],...,xN[ n ],r1[ n ],...,rK[ n ])            xN[ n+1 ]=fN(x1[ n ],...,xN[ n ],r1[ n ],...,rK[ n ])(9.133)

Each right-side function fi (...) includes, as arguments, all input signals as well as the state variables. In addition to this change, the output equation given by Eqn. (9.132) needs to be replaced with a set of output equations for computing all output signals:

y1[ n ]=g1(x1[ n ],...,xN[ n ],r1[ n ],...,rK[ n ])y2[ n ]=g2(x1[ n ],...,xN[ n ],r1[ n ],...,rK[ n ])       yM[ n ]=gM(x1[ n ],...,xN[ n ],r1[ n ],...,rK[ n ])(9.134)

9.3.1 State-space models for DTLTI systems

If the discrete-time system under consideration is also linear and time-invariant (DTLTI), the right-side functions fi (...), i = 1,..., N and gi (...), i = 1,..., M in Eqns. (9.133) and (9.134) are linear functions of the state variables and the input signals. For a single-input single-output DTLTI system, the state-space representation is in the form

x1[ n+1 ]=a11x1[ n ]+a12x2[ n ]+...+a1NxN[ n ]+b1r[ n ]x2[ n+1 ]=a21x1[ n ]+a22x2[ n ]+...+a2NxN[ n ]+b2r[ n ]           xN[ n+1 ]=aN1x1[ n ]+aN2x2[ n ]+...+aNNxN[ n ]+bNr[ n ](9.135)

and the output equation is

y[ n ]=c1x1[ n ]+c2x2[ n ]+...,cNxN[ n ]+dr[ n ](9.136)

where the coefficients aij, bi, cj and d used in the state equations and the output equation are all constants independent of the time variable. Eqns. (9.135) and (9.136) can be expressed in matrix notation as follows:

State equation:x[ n+1 ]=Ax[ n ]+Br[ n ](9.137)

Output equation:y[ n ]=Cx[ n ]+d r[ n ](9.138)

The coefficient matrices used in Eqns. (9.137) and (9.138) are

A=[ a11a12...a1Na21a22...a2NaN1aN2...aNN ],B=[ b1b2b3b4 ],C=[ c1c2cN ](9.139)

The vector x [n] is the state vector that consists of the N state variables:

x[ n ]=[ x1[ n ]x2[ n ]xN[ n ] ](9.140)

The vector x [n + 1] contains versions of the N state variables advanced by one sample:

x[ n+1 ]=[ x1[ n+1 ]x2[ n+1 ]xN[ n+1 ] ](9.141)

Thus, a single-input single-output DTLTI system can be uniquely described by means of the matrix A, the vectors B and C, and the scalar d. If the initial value x [0] of the state vector is known, the state equation given by Eqn. (9.137) can be solved for x [n]. Once x [n] is determined, the output signal can be found through the use of Eqn. (9.138).

9.3.2 Obtaining state-space model from difference equation

Converting a N-th order difference equation to a state-space model requires finding N first-order difference equations that represent the same system, and an output equation that links the output signal to the state variables. As in the case of continuous-time state-space models, the solution is not unique. Consider a DTLTI system described by a difference equation in the form

y[ n ]+a1y[ n-1 ]+a2y[ n-2 ]+...+aN-1y[ n-N+1 ]aNy[ n-N ]=b0r[ n ](9.142)

Let us rewrite the difference equation so that y [n] is computed from the remaining terms:

y[ n ]=-a1y[ n-1 ]-a2y[ n-2 ]-...-aN-1y[ n-N+1 ]-aNy[ n-N ]+b0r[ n ](9.143)

We will choose the state variables as follows:

x1[ n ]=y[ n-N ]x2[ n ]=y[ n-N+1 ]x1[ n+1 ]=x2[ n ]x3[ n ]=y[ n-N+2 ]x2[ n+1 ]=x3[ n ]          xN[ n ]=y[ n-1 ]xN-1[ n+1 ]=xN[ n ]

The resulting state equations are

x1[ n+1 ]=x2[ n ]x2[ n+1 ]=x3[ n ]                xN-1[ n+1 ]=xN[ n ]xN[ n+1 ]=-aNx1[ n ]-aN-1x2[ n ]-...-a2xN-1[ n ]-a1xN[ n ]+b0r[ n ](9.144)

The last state equation is obtained by using the state variables x1[n] through xN [n] defined above in the difference equation given by Eqn. (9.143), and writing y [n]= xN [n + 1] in terms of the state variables x1[n] through xN [n] and the input signal r [n]. The output equation is readily obtained from the last state equation:

y[ n ]=xN[ n+1 ]=-aNx1[ n ]-aN-1x2[ n ]-...-a2xN-1[ n ]-a1xN[ n ]+b0r[ n ](9.145)

In matrix form, the state-space model is

x[ n+1 ]=Ax[ n ]+r[ n ]y[ n ]=Cx[ n ]+dr[ n ]

with

A=[ 010...00001...00...000...10000...01-aN-aN-1-aN-2...-a2-a1 ],B=[ 0000b0 ](9.146)

for the state equation, and

C=[ -aN-aN-1-aN-2...-a2-a1 ],d=b0(9.147)

for the output equation. This is the familiar phase-variable canonical form we have seen in the analysis of continuous-time state-space models. The coefficient matrix A is given below in partitioned form:

image

The top left partition is a (N − 1) × 1 vector of zeros; the top right partition is an identity matrix of order (N − 1); the bottom row is a vector of difference equation coefficients in reverse order and with a sign change. This is handy for obtaining the state-space model by directly inspecting the difference equation. It is important to remember, however, that the coefficient of y [n] in Eqn. (9.142) must be equal to unity for this to work.

Example 9.16: State-space model from difference equation

Find a state-space model for a DTLTI system described by the difference equation

y[ n ]+1.2y[ n-1 ]-0.13y[ n-2 ]-0.36y[ n-3 ]=2r[ n ]

Solution: Expressing y [n] as a function of the other terms leads to

y[ n ]=-1.2y[ n-1 ]+0.13y[ n-2 ]+0.36y[ n-3 ]+2r[ n ](9.149)

State variables can be defined as

x1[ n ]=y[ n-3 ]x2[ n ]=y[ n-2 ]x1[ n+1 ]=x2[ n ]x3[ n ]=y[ n-1 ]x2[ n+1 ]=x3[ n ]

Recognizing that

y[ n ]=x3[ n+1 ]

the difference equation in Eqn. (9.149) can be written as

x3[ n+1 ]=-1.2x3[ n ]+0.13x2[ n ]+0.36x1[ n ]+2r[ n ]

In matrix form, the state-space model is

x[ n+1 ]=[ 0100010.360.13-1.2 ]x[ n ]+[ 002 ]r[ n ]y[ n ]=[ 0.360.13-1.2 ]x[ n ]+2r[ n ]

The inspection method for deriving the state-space model directly from the difference equation would not be as straightforward to use if delayed versions of the input signal r [n] appear in the difference equation. We will, however, generalize the relationship between the coefficients of the difference equation and the state-space model when we consider the derivation of the latter from the system function in the next section.

9.3.3 Obtaining state-space model from system function

If the DTLTI system under consideration has a system function that is simple in the sense that it has no multiple poles and all of its poles are real-valued, then a state-space model can be easily found using partial fraction expansion. This idea will be explored in the next example.

Example 9.17: State-space model from z-domain system function

A DTLTI system has the system function

H(z)=Y(z)R(z)=7z(z-0.6)(z+0.8)

Find a state-space model for this system.

Solution: Expanding H (z) into partial fractions we get

H(z)=3z-0.6+4z+0.8

Note that we did not divide H (z) by z before expanding it into partial fractions, since in this case we do not need the z term in the numerator of each partial fraction. The z-transform of the output signal is

Y(z)3z-0.6R(z)+4z+0.8R(z)

Let us define X1 (z) and X 2 (z) as

X1(z)=3z-0.6R(z)(9.150)

and

X2(z)=4z+0.8R(z)(9.151)

so that Y (z) = X1 (x) + X2 (z). Rearranging the terms in Eqns. (9.150) and (9.151) we get

zX1(z)=0.6X1(z)+3 R(z)(9.152)

and similarly

zX2(z)=-0.8X2(z)+4 R(z)(9.153)

Taking the inverse z-transform of Eqns. (9.152) and (9.153) leads to the two first-order difference equations

x1[ n+1 ]=0.6x1[ n ]+3r[ n ](9.154)

x2[ n+1 ]=-0.8x2[ n ]+4 r[ n ](9.155)

The output equation is

y[ n ]=x1[ n ]+x2[ n ](9.156)

Using x1[n] and x2[n] as the state variables, the state-space model can be written as

[ x1[ n+1 ]x2[ n+1 ] ]=[ 0.600-0.8 ][ x1[ n ]x2[ n ] ]+[ 34 ]r[ n ]y[ n ]=[ 11 ][ x1[ n ]x2[ n ] ]

and

y[ n ]=[ 11 ][ x1[ n ]x2[ n ] ]

A state-space model was easily obtained for the system in Example 9.17 owing to the fact that the system function H (z) has only first-order real poles. As in the continuous-time case, the state equations obtained in Eqns. (9.154) and (9.155) are uncoupled from each other, that is, each state equation involves only one of the state variables. This leads to a state matrix A that is diagonal. It is therefore possible to solve the state equations independently of each other.

If the system function does not have the properties that afforded us the simplified solution of Example 9.17, finding a state-space model for a system function involves the use of a block diagram as an intermediate step.

Consider the system function

H(z)=Y(z)X(z)=b0+b1z-1+b2z-2+b3z-31+a1z-1+a2z-2+a3z-3(9.157)

A direct-form II block diagram for implementing this system is shown in Fig. 9.11 (see Section 8.6 of Chapter 8 for the details of obtaining a block diagram).

Figure 9.11

Figure showing Simulation diagram for H (z) of Eqn. (9.157).

Simulation diagram for H (z) of Eqn. (9.157).

We know from time shifting property of the z-transform (see Section 8.3.2 of Chapter 8) that multiplication of a transform by z−1 is equivalent to right shifting the corresponding signal by one sample in the time domain. A time-domain equivalent of the block diagram in Fig. 9.11 is obtained by replacing z−1 components with delays and using time-domain versions of input and output quantities. The resulting diagram is shown in Fig. 9.12.

Figure 9.12

Figure showing Selecting states from the block diagram for H (z).

Selecting states from the block diagram for H (z).

A state-space model can be obtained from the diagram of Fig. 9.134 as follows:

  1. Designate the output signal of each delay element as a state variable. These are marked in Fig. 9.12 as x1[n], x2[n] and x3[n].
  2. The input of each delay element is a one sample advanced version of the corresponding state variable. These are marked in Fig. 9.12 as x1[n + 1], x2[n + 1] and x3[n + 1].
  3. Express the input signal of each delay element as a function of the state variables and the input signal as dictated by the diagram.

Following state equations are obtained by inspecting the diagram:

x1[ n+1 ]=x2[ n ](9.158)

x2[ n+1 ]=x3[ n ](9.159)

x3[ n+1 ]=-a3x1[ n ]-a2x2[ n ]-a1x3[ n ]+r[ n ](9.160)

The output signal can be written as

y[ n ]=b3x1[ n ]+b2x2[ n ]+b1x3[ n ]+b0x3[ n+1 ](9.161)

Since we do not want the x3[n + 1] term on the right side of the output equation, Eqn. (9.160) needs to be substituted into Eqn. (9.161) to obtain the proper output equation:

y[ n ]=(b3-b0a3)x1[ n ]+(b2-b0a2)x2[ n ]+(b1-b0a1)x3[ n ]+b0r[ n ](9.162)

Expressed in matrix form, the state-space model is

x.[n+1]=[010001-a3-a2-a1 ]x[ n ]+[ 001 ]r[ n ](9.163)

y[ n ]=[ (b3-b0a3)(b2-b0a2)(b1-b0a1) ]x[ n ]+b0 r[ n ](9.164)

The results can be easily extended to a N-th order system function in the form

H(z)=Y(z)X(z)=b0+b1z-1+b2z-2+...+...bMz-M1+a1z-1+a2z-2+...+aNz-N(9.165)

to produce the state-space model

x[ n+1 ]=[ 0100...00010...00001...0...0000...1-aN-aN-1-aN-2-aN-3...-a1 ]x[ n ]+[ 00001 ] r[ n ](9.166)

y[ n ]=[ (bN-b0aN)(bN-1-b0aN-1)...(b1-b0a1) ]x[ n ]+b0 r[ n ](9.167)

The structure of the coefficient matrix A is the same as in Eqn. (9.146). Similarly, the vector B is identical to that found in Section 9.3.2.

Example 9.18: State-space model from block diagram for DTLTI system

Find a state-space model for the DTLTI system described through the system function

H(z)=z3-7z+6z4-z3-0.34z2+0.966z-0.2403

Solution: A cascade form block diagram for this system was drawn in Example 8.43 of Chapter 8 and is shown again in Fig. 9.13 with state variable assignments marked. Writing the input signal of each delay element in terms of the other signals in the diagram we obtain

Figure 9.13

Figure showing Cascade form block diagram for Example 9.18.

Cascade form block diagram for Example 9.18.

x1[ n+1 ]=x2[ n ](9.168)

x2[ n+1 ]=0.27x1[ n ]-0.6x2[ n ]+r[ n ](9.169)

x3[ n+1 ]=x4[ n ](9.170)

x4[ n+1 ]=-3x1[ n ]+2x2[ n ]+x2[ n+1 ]-0.89x3[ n ]+1.6x4[ n ](9.171)

Eqn. (9.171) contains the undesired term x2[n + 1] on the right side of the equal sign. This needs to be resolved by substitution of Eqn. (9.169) into Eqn. (9.171):

x4[ n+1 ]=-2.73x1[ n ]+1.4x2[ n ]-0.89x3[ n ]+1.6x4[ n ]+r[ n ](9.172)

The output equation is

y[ n ]=-2x3[ n ]+x4[ n ](9.173)

In matrix form, the state-space model is

x[ n+1 ]=[ 01000.27-0.6000001-2.731.4-0.891.6 ]x[ n ]+[ 0101 ]r[ n ]y[ n ]=[ 00-21 ]x[ n ]

9.3.4 Solution of state-space model

Discrete-time state equations can be solved iteratively. Consider the state-space model given by Eqns. (9.137) and (9.138). Given the initial state vector x [0] and the input signal r[n] the iterative solution proceeds as follows:

  1. Using n = 0, compute x [1], the state vector at n + 1 = 1 using

    x[ 1 ]=Ax[ 0 ]+B r[ 0 ]

  2. Compute the output sample at n = 0 using

    y[ 0 ]=Cx[ 0 ]+d r[ 0 ]

  3. Increment n by 1, and repeat steps 1 and 2.

The iterative solution method allows as many samples of the output signal to be obtained as desired. If an analytical solution is needed, however, we need to follow an alternative approach and obtain a general expression for y [n], similar to the development in Section 9.2.7 for continuous-time state-space models. It is possible to find an analytical solution by obtaining the homogeneous and particular solutions and combining them. Instead, we will use the z-transform approach. Taking the unilateral z-transform of both sides of Eqn. (9.137) we obtain

z X(z)-zx[ 0 ]=AX(z)+B R(z)(9.174)

Solving Eqn. (9.174) gives

X(z)=z[ z I-A ]-1x[ 0 ]+[ z I-A ]-1B R(z)(9.175)

The matrix

Φ(z)=z[ z I-A ]-1(9.176)

is the z-transform version of the resolvent matrix. Using it in Eqn. (9.175) yields

X(z)=Φ(z)x(0)+z-1Φ(z)B R(z)(9.177)

for the solution in the z domain. Taking the inverse z-transform of Eqn. (9.177) and recognizing that the inverse z-transform of the product Φ (z) R(z) is the convolution of the corresponding time-domain functions leads to the solution

x[ n ]=ϕ[ n ]x[ 0 ]+m=0n-1ϕ[ n-1-m ]B r[ m ](9.178)

where ϕ [n] is the discrete-time version of the state transition matrix computed as

ϕ[ n ]=Z-1{ Φ(z) }=Z-1{ z[ z I-A ]-1 }(9.179)

Example 9.19: Solution of discrete-time state-space model

Compute the unit-step response of the discrete-time system described by the state-space model

x[ n+1 ]=[ 0-0.50.250.75 ]x[ n ]+[ 21 ]r[ n ]y[ n ]=[ 31 ]x[ n ]

using the initial state vector

x[ 0 ]=[ 20 ]

Solution: We will begin by forming the the matrix [z IA]:

[ z I-A ]=z[ 1001 ]-[ 0-0.50.250.75 ]=[ z0.5-0.25z-0.75 ]

The resolvent matrix is found as

Φ(z)=z(z-0.5)(z-0.25)[ z-0.75-0.50.25z ]

The state transition matrix is found by taking the inverse z-transform of the resolvent matrix:

ϕ[ n ]=[ -(0.5)nu[ n ]+2(0.25)nu[ n ]-2(0.5)nu[ n ]+2(0.25)nu[ n ]  (0.5)nu[ n ]-(0.25)nu[ n ]  2(0.5)nu[ n ]-(0.25)nu[ n ] ]

The solution of the state equation is found by using the state transition matrix in Eqn. (9.178):

x[ n ]=[ 6(0.5)nu[ n ]-4(0.25)nu[ n ]-6(0.5)nu[ n ]+2(0.25)nu[ n ]+4u[ n ] ]

The output signal is

y[ n ]=[ 31 ]x[ n ]=12(0.5)nu[ n ]-10(0.25)nu[ n ]+4u[ n ]

Software resources:

ex_9_19a.m

ex_9_19b.m

9.3.5 Obtaining system function from state-space model

The z-domain system function H (z) of a DTLTI system can be easily obtained from its state-space description. Consider Eqn. (9.175) derived in the process of obtaining the solution for the z-transform of the state vector:

Eqn.(9.175):X(z)=z[ z I-A ]-1x[ 0 ]+[ z I-A ]-1B R(z)

Recall that the system function concept is valid only for a system that is both linear and time-invariant. If the system is DTLTI, then the initial value of the state vector is x[0] = 0, and Eqn. (9.175) becomes

X(z)=[ z I-A ]-1B R(z)(9.180)

Using X (z) in the output equation leads to

Y(z)=CX(z)+d R(z)=C[ z I-A ]-1B R(z)+d R(z)(9.181)

from which the system function follows as

H(z)=Y(z)R(z)=C[ z I-A ]-1B+d

9.4 Discretization of Continuous-Time State-Space Model

As discussed in Section 9.3.4 of this chapter, discrete-time state-space models have the added advantage that they can be solved iteratively one step at a time. On the other hand, a continuous-time state-space model cannot be solved iteratively unless it is first converted to an approximate discrete-time model. There are times when we may want to simulate an analog system on a digital computer. In this section we will discuss methods for discretizing a continuous-time state-space model. Only single-input-single-output systems will discussed although extension to systems with multiple inputs and/or outputs is straightforward. Let an analog system be described by the equations

x˙A(t)=A xA(t)+B rA(t)(9.182)

yA(t)=Cxa(t)+drA(t)(9.183)

In Eqns. (9.182) and (9.182) the subscript “a” is used to indicate analog variables. The discretization problem is stated as follows:

Given the state-space model for the analog system, find a discrete-time system with the state-space model

x[ n+1 ]=A¯x[ n ]+B¯r[ n ](9.184)

y[ n ]=C¯x[ n ]+d¯r[ n ](9.185)

so that, for a sampling interval Ts we have

x[ n ]xA(nTs)andy[ n ]yA(nTs)(9.186)

when r [n] = ra (nTs). The value of Ts must be chosen to satisfy the sampling criteria (see Chapter 6).

The solution for the continuous-time state-space model was given in Section 9.2.7 by Eqn. (9.113) which is repeated here:

Eqn.(9.113):xa(t)=eA(t-t0)xa(t0)+t0teA(t-τ)B rA(τ) dτ(9.187)

Eqn. (9.113) starts with the solution at time t0 and returns the solution at time t. By selecting the limits of the integral to be t0 = nTs and t = (n + 1)Ts, Eqn. (9.113) becomes

xa((n+1)Ts)=eATsxa(nTs)+nTs(n+1)TseA((n+1)Ts-τ)B rA(τ) dτ

If Ts is small enough the term ra (τ) may be assumed to be constant within the span of the integral, that is,

rA(τ)rA(nTs)fornTsτ(n+1)Ts(9.188)

With this assumption Eqn. (9.188) becomes

xa((n+1)Ts)eATAxa(nTs)+[ nTs(n+1)TseA((n+1)Ts-τ)dτ ] B rA(nTs)(9.189)

Using the variable change λ = (n + 1)Ts − τ on the integral in Eqn. (9.189) we obtain

xa((n+1)Ts)eATsxa(nTs)+[ 0TseAλdλ ]B rA(nTs)=eATsxa(nTs)+A-1[ eATs-I ] B rA(nTs)(9.190)

Finally, substitution of ra (nTs) = r[n] and xa (nTs) = x[n] yields

x[ n+1 ]=eATsx[ n ]+A-1[ eATs-I ] B r[ n ]

The output equation is simply

y[ n ]=Cx[ n ]+d r[ n ](9.191)

In summary, the continuous-time system described by Eqns. (9.182) and (9.183) can be approximated with the discrete-time system in Eqns. (9.184) and (9.185) by choosing the coefficient matrices as follows:

Discretization of state-space model:

A¯=eATs,B¯=A-1[ eATs-I ]B,C¯=C,d¯=d(9.192)

Example 9.20: Discretization of state-space model for RLC circuit

A state-space model for the RLC circuit in Fig. 9.3 was found in Example 9.1 as

x˙(t)=[ -2-21-5 ] x(t)+[ 10 ] r(t)y(t)=[ 05 ] x(t)

The state transition matrix corresponding to this model was found in Example 9.13 as

eAt=ϕ(t)=[ (2e-3t-e-4t)(-2e-3t+2e-4t)(e-3t-e-4t)(-e-3t+2e-4t) ]

Using a step size of Ts = 0.1 s, find a discrete-time state-space model to approximate the continuous-time model given above.

Solution: Let us begin by evaluating the state transition matrix at t = Ts = 0.1 s.

eATs=ϕ(0.1)=[ (2e-0.3-e-0.4)(-2e-0.3+2e-0.4)(e-0.3-e-0.4)(-e-0.3+2e-0.4) ]=[ 0.8113-0.14100.07050.5998 ]

The state matrix of the discrete-time model is

A¯=eATs=[ 0.8113-0.14100.07050.5998 ]

The inverse of state matrix A is

A-1=[ -0.41670.1667-0.0833-0.1667 ]

which can be used for computing the vector B¯ as

B¯=A-1[ eATs-I ]B=[ -0.41670.1667-0.0833-0.1667 ]([ 0.8113-0.14100.07050.5998 ]-[ 1001 ])[ 10 ]=[ -0.25470.0952 ]

Therefore, the discretized state-space model for the RLC circuit in question is

x[ n+1 ]=[ 0.8113-0.14100.07050.5998 ]x[ n ]+[ -0.25470.0952 ]r[ n ]y[ n ]=[ 05 ]x[ n ]

Software resources:

ex_9_20.m

Software resources:

See MATLAB Exercise 9.8.

The only potential drawback for the discretization technique derived above is that it requires inversion of the matrix A and computation of the state transition matrix. Simpler approximations are also available. An example of a simpler technique is the Euler method which was applied to a first-order scalar differential equation in MATLAB Exercise 2.4 in Chapter 2.

Let us evaluate the continuous-time state equation given by 9.182 at t = nTs:

x˙a(t)|t=nTs=A xa(nTs)+B rA(nTs)(9.193)

The derivative on the left side of Eqn. (9.193) can be approximated using the first difference

x˙a(t)|t=nTs1Ts[ xa(n(n+1)Ts)-xa(nTs) ](9.194)

Substituting Eqn. (9.194) into Eqn. (9.193) and rearranging terms gives

x((n+1)Ts)[ I+aTs ]x(nTs)+TsB r(nTs)(9.195)

Through substitutions ra (nTs) = r[n] and xa (nTs) = x[n] we obtain

x[ n+1 ]=[ I+ATs ]x[ n ]+TsB r[ n ](9.196)

The output equation is

y[ n ]=Cx[ n ]+d r[ n ](9.197)

as before.

The results can be summarized as follows:

Discretization using Euler method:

A¯=I+ATs,B¯=Ts B,C¯=C,d¯=d(9.198)

Since this is a first-order approximation method, the step size (sampling interval) Ts chosen should be significantly small compared to the time constant.

Software resources:

See MATLAB Exercise 9.8.

9.5 Further Reading

[1] R.C. Dorf and R.H. Bishop. Modern Control Systems. Prentice Hall, 2011.

[2] B. Friedland. Control System Design: An Introduction to State-Space Methods. Dover Publications, 2012.

[3] K. Ogata. Modern Control Engineering. Instrumentation and Controls Series. Prentice Hall, 2010.

[4] L.A. Zadeh and C.A. Desoer. Linear System Theory: The State Space Approach. Dover Civil and Mechanical Engineering Series. Dover Publications, 2008.

MATLAB Exercises

MATLAB Exercise 9.1: Obtaining state-space model from system function

MATLAB function tf2ss(..) facilitates conversion of a rational system function in the s domain to a state-space model. Consider a CTLTI system with the system function

H(s)=s2+s-2s2+6s+5

A state-space model for the system is obtained as

 >> num = [1, 1, -2];
 >> den = [1, 6, 5];
 >> [A, B, C, d] = tf2ss(num, den)
 A =
  -6  -5
  1  0
 B =
  1
  0
 C =
  -5  -7
 d =
  1

and corresponds to

x˙(t)=[ -6-510 ] x(t)+[ 10 ] r(t)y(t)=[ -5-7 ] x(t)+r(t)

1 function [A,B,C,d] = ss_t2s (num ,den)
2   nden = length (den); % Size of denominator vector
3   N = nden - 1;  % Order of system
4   % If 'num' has fewer elements than 'den', put zeros in front.
5   while (length (num)<nden)
6  num = [0, num];
7   end;
8   % Divide all coefficients by leading denominator coefficient
9   num = num/den (1);
10  den = den/den (1);
11  num = fliplr (num);  % Reorder numerator coefficients
12  den = fliplr (den);  % Reorder denominator coefficients
13  A = [zeros(N-1,1), eye(N-1);- den (1:N)];
14  B = [zeros(N -1 ,1);1];
15  C = num (1:N)-num(N+1)* den (1:N);
16  d = num(N+1);
17 end

After line 12 of the code is executed, the vectors “num” and “den” are structured as follows:

num=[ a0,a1,...,aN-1,1 ](9.199)

den=[ b0,b1,...,bN-1,bN ](9.200)

The construction of state-space model in lines 13 through 16 follows the development in Section 9.2.4 Eqns. (9.53) and (9.54). Using the function “ss_t2s” another state-space model for the same system is obtained as

  >> num = [1,1,-2];
  >> den = [1,6,5];
  >> [A,B,C,d] = ss_t2s (num ,den)
  A =
   0  1
  -5  -6
  B =
   0
   1
  C =
  -7  -5
  d =
   1

and corresponds to

z˙(t)=[ 01-5-6 ] z(t)+[ 01 ] r(t)y(t)=[ -7-5 ] z(t)+r(t)

It can easily be shown (see Problem 9.9 at the end of this chapter) that this state-space model is related to the one found using MATLAB function tf2ss(..) by the transformation

x(t)=[ 0110 ]z(t)

Software resources:

matex_9_1a.m

matex_9_1b.m

ss_t2s.m

MATLAB Exercise 9.2: Diagonalizing the state matrix

The state-space description of a system is not unique. It was discussed in Section 9.2.5 that, for a given state-space model that uses the state vector x (t), alternative models can be obtained through similarity transformations. An alternative form using the new state vector z (t) is given by

z˙(t)=A˜z(t)+B˜r(t)y(t)=C˜z(t)+dr(t)

Sometimes it is desirable to find a state-space model with a diagonal coefficient matrix so that the resulting first-order differential equations are uncoupled from each other. Let λ1, λ2, ..., λN be the eigenvalues of the matrix A with corresponding eigenvectors v1, v2, ..., vN. It can be shown that, if A has distinct eigenvalues, a transformation matrix P constructed as

P=[ v1|v2|...|vN ]

leads to a state-space model with A¯=P-1AP a diagonal matrix. MATLAB function eig(..) can be used to obtain both the eigenvalues and the eigenvectors.

Let the state-space model of a system be

x˙(t)=[ 6.521.5-10.5-2-1.55.522.5 ]x(t)+[ 1-20 ]r(t)y(t)=[ -1-1-2 ]x(t)

The state-space model may be entered into MATLAB and an alternative model with a diagonal state matrix may be computed through the following:

 >>  A = [6.5 ,2 ,1.5; -10.5, -2, -1.5;5.5, 2, 2.5];
 >>  B = [1; , -2;0];
 >>  C = [-1,-1,-2];
 >>  [P,E] = eig (A);
 >>  A_bar = inv (P)* A*P
 A_bar =
  4.0000  -0.0000  -0.0000
  0.0000   1.0000  0.0000
  0.0000   0.0000  2.0000
 >> B_bar = inv (P)* B
 B_bar =
   -0.0000
  2.9580
  -4.9749
 >> C_bar = C*P
 C_bar =
   0.4082  0.3381  -0.0000

The results lead to a new state-space model as follows:

z˙(t)=[ 400010002 ]z(t)+[ 02.9580-4.9749 ]r(t)

Software resources:

matex_9_2.m

MATLAB Exercise 9.3: Computation of the state transition matrix

In this exercise we will explore various approaches to the problem of computing the state transition matrix through the use of MATLAB. The definition of the state transition matrix was given by Eqn. (9.102) which is repeated here:

Eqn.(9.102):ϕ(t)=eAt

An infinite series form of the state transition matrix was also given, and is repeated below:

Eqn.(9.100):eAt=I+At+12!A2t2+...+1n!Antn+...

Consider the coefficient matrix A that was used in Example 9.12:

A=[ -1-1010-157-6 ]

It is possible to compute the complex exponential function eAt at one specific time instant using the MATLAB function expm(..). The following segment of code computes ϕ (0.2), the value of the state transition matrix at time t = 0.2:

  >> A = [-1 , -1 ,0; 1 ,0 , -1; 5 ,7 , -6];
  >> expm (A *0.2)
  ans =
   0.8061 -0.1737 0.0126
   0.1105  0.8913  -0.1105
   0.5778  0.7103 0.2410

It is important to remember to use the function expm(..) and not the function exp(..) for this purpose. The latter function computes the exponential function of each element of the matrix which is not the same as computing eAt.

It is also possible to approximate the state transition matrix by using the first few terms of the infinite series for it. The infinite series can be written in nested form as

ϕ(t)=eAt=I+At[ I+12At[ I+13At[ I+14At[ I+......... ] ] ] ](9.201)

The following code segment computes the first five terms of the series for ϕ (0.2):

  >>  id = eye (3);
  >>  At = A *0.2;
  >>  id+ At *(id +At /2*(id +At /3*(id +At /4)))
  ans =
   0.8057  -0.1743  0.0130
   0.1093   0.8891  -0.1093
   0.5727   0.7003  0.2461

Even though we have used only the first five terms, the result obtained is quite close to that obtained through the use of the function expm(..). The accuracy of the approximation can be improved by including more terms.

Both code segments listed above compute the state transition matrix at one specific time instant. If elements of the state transition matrix are needed as functions of time over a specified interval, the function expm(..) can be used within a loop. The script listed below computes and graphs ϕ12 (t), the row-1 column-2 element of the state transition matrix, in the time interval 0 ≤ t ≤ 4 sec.

1 % Script : matex_9_3a.m
2 %
3 t = [0:0.01:4];   % Set a time vector “t”
4 % Create an empty vector “phi12” to fill later
5 phi12 =[];
6 % Compute the STM for each element of vector “t”
7 for i =1: length (t),
8  time = t(i);     % Pick a time instant
9  stm = expm (A* time);   % Compute the STM at time instant t(i)
10 phi12 = [phi12 , stm (1 ,2)];  % Append element (1, 2) to vector “phi12”
11  end;
12  % Graph element (1 ,2) of the STM
13  plot (t, phi12);
14  grid;
15  title (’Element 1,2 of the state transition matrix ’);
16  xlabel (’t (sec)’);

The graph produced is shown in Fig. 9.14.

Figure 9.14

Figure showing Graph obtained in MATLAB Exercise 9.3.

Graph obtained in MATLAB Exercise 9.3.

This result should be compared to the analytical expression obtained in Example 9.12 for the element ϕ12 (t):

ϕ12(t)=-53e-t+2e-2t-13e-4t

The following code segment computes and graphs the analytical form of ϕ12 (t) for comparison:

  >> phi12a = -5/3* exp (-t)+2* exp (-2* t) -1/3* exp (-4* t);
  >> plot (t , phi12a);

Software resources:

matex_9_3a.m

matex_9_3b.m

MATLAB Exercise 9.4: Solving the homogeneous state equation

Consider the homogeneous state equation

x˙(t)=[ 05-2-2 ]x(t)

Let the initial value of the state vector be

x(0)=[ 1-2 ]

Using MATLAB, compute and graph the state transition matrix ϕ (t) in the interval 0 ≤ t ≤ 4 s. Afterwards, compute and graph the state vector x (t) in the same time interval.

Solution: The solution of the homogeneous state equation is computed as

x(t)=ϕ(t)x(0)t0

The state transition matrix is the form

ϕ(t)=[ ϕ11(t)ϕ12(t)ϕ21(t)ϕ22(t) ]

Using the state transition matrix with the initial value of the state vector we obtain

x(t)=[ ϕ11(t)ϕ12(t)ϕ21(t)ϕ22(t) ][ 1-2 ]=[ ϕ11(t)-2ϕ12(t)ϕ21(t)-2ϕ22(t) ]

The function expm(..) was first used in MATLAB Exercise 9.3 for computing the state transition matrix at for specific value of t. In the script listed below it is used in a loop structure for computing the state transition matrix at a set of time instants. The elements of the state transition matrix are computed and graphed. The result is shown in Fig. 9.15.

Figure 9.15

Figure showing Elements of state transition matrix for MATLAB Exercise 9.4.

Elements of state transition matrix for MATLAB Exercise 9.4.

1 % Script : matex_9_4a.m
2 %
3 A = [0 ,5; -2 , -2]; % State matrix
4 t = [0:0.01:4];  % Set a time vector ’t’
5 % Create empty vectors ’phi11 ’, ’phi12 ’, etc. to fill later
6 phi11 =[];
7 phi12 =[];
8 phi21 =[];
9 phi22 =[];
10  % Compute the STM for each element of vector ’t’
11  for i=1: length (t),
12  time = t(i);     % Pick a time instant
13  stm = expm (A* time);   % Compute the STM at time instant t(i)
14  phi11 = [phi11 , stm (1 ,1)]; % Append element (1 ,1) to vector ’phi11 ’
15  phi12 = [phi12 , stm (1 ,2)]; % Append element (1 ,2) to vector ’phi12 ’
16  phi21 = [phi21 , stm (2 ,1)]; % Append element (2 ,1) to vector ’phi21 ’
17  phi22 = [phi22 , stm (2 ,2)]; % Append element (2 ,2) to vector ’phi22 ’
18 end ;
19 % Graph elements of the STM
20 clf ;
21 subplot (2 ,2 ,1)
22 plot (t, phi11); grid ;
23 title (’ phi_ {11}(t) ’);
24 subplot (2 ,2 ,2)
25 plot (t, phi12); grid ;
26 title (’ phi_ {12}(t)’);
27 subplot (2 ,2 ,3)
28 plot (t, phi21); grid ;
29 title (’ phi_ {21}(t)’);
30 subplot (2 ,2 ,4)
31 plot (t, phi22); grid ;
32 title (’ phi_ {22}(t)’);

The script listed below computes and graphs the elements of the state vector. It relies on the previous script to be run first, so that vectors “t”, “phi11”, “phi12”,“phi21” and “phi22” are already in MATLAB workspace.

1 % Script : matex_9_4b.m
2 %
3 % Compute elements of the state vector
4 x1 = phi11 -2* phi12 ;
5 x2 = phi21 -2* phi22 ;
6 % Graph elements of the state vector
7 clf ;
8 subplot (2 ,1 ,1)
9 plot (t, x1); grid ;
10  title (’x_ {1}(t) ’);
11  subplot (2 ,1 ,2)
12  plot (t, x2); grid ;
13  title (’x_ {2}(t) ’);

The graph produced by the script matex_9_4b.m is shown in Fig. 9.16.

Figure 9.16

Figure showing Elements of state vector for MATLAB Exercise 9.4.

Elements of state vector for MATLAB Exercise 9.4.

Software resources:

matex_9_4a.m

matex_9_4b.m

MATLAB Exercise 9.5: Symbolic computation of the state transition matrix

It is also possible to compute the state transition matrix using symbolic mathematics capabilities of MATLAB. This is especially useful for checking solutions to homework problems. Consider the system a state-space model of which was given in Example 9.13. The coefficient matrix is

A=[ -2-21-5 ]

The state transition matrix phi (t) can be computed as a symbolic expression using the following lines of code:

  >> A = [-2,-2; 1,-5];
  >> t = sym (’t’); % Define symbolic variable.
  >> expm (A*t)    % Compute the state transition matrix.
  ans =
  [2/ exp (3* t) - 1/ exp (4* t), 2/ exp (4* t) - 2/ exp (3* t)]
  [1/ exp (3* t) - 1/ exp (4* t), 2/ exp (4* t) - 1/ exp (3* t)]

The symbolic answer produced should match the result found in Example 9.13.

An alternative approach would be to

  1. Obtain the resolvent matrix Φ (s).
  2. Obtain the state transition matrix as the inverse Laplace transform of the resolvent matrix.

Mathematically we have

Eqn.(9.120):Φ(s)=[ s I-A ]-1(9.202)

Eqn.(9.119):Φ(t)=-1{ [ s I-A ]-1 }(9.203)

The following lines of code implement this approach using the symbolic mathematics capabilities of MATLAB:

 >> s = sym (’s’);  % Define symbolic variable.
 >> tmp = s* eye (2) - A;
 >> rsm = inv (tmp)  % Resolvent matrix.
 rsm =
 [(s + 5)/(s^2 + 7* s + 12) , -2/(s ^2 + 7* s + 12)]
 [ 1/(s^2 + 7* s + 12) , (s + 2)/(s^2 + 7*s + 12)]
 >> stm = ilaplace (rsm)% State transition matrix.
 stm =
 [2/ exp (3* t) - 1/ exp (4* t), 2/ exp (4* t) - 2/ exp (3* t)]
 [1/ exp (3* t) - 1/ exp (4* t), 2/ exp (4* t) - 1/ exp (3* t)]

Software resources:

matex_9_5a.m

matex_9_5b.m

MATLAB Exercise 9.6: Obtaining system function from continuous-time state-space model

In Example 9.14 we have obtained the system function of a second-order CTLTI system from its state-space model. Verify the solution using symbolic mathematics capabilities of MATLAB.

Solution: Symbolic computation of the state transition matrix was discussed in MATLAB Exercise 9.5. Extending the technique used in that exercise, the system function can be found with the following statements:

 >> A = [-2,-2;1,-5];
 >> B = [1;0];
 >> C = [0 ,5];
 >> D = [0];
 >> s = sym (’s’);
 >> tmp = s* eye (2) - A
 tmp =
 [s + 2, 2]
 [-1, s + 5]
 >> rsm = inv (tmp)
 rsm =
 [(s + 5)/(s ^2 + 7* s + 12) , -2/(s ^2 + 7* s + 12)]
 [ 1/(s ^2 + 7* s + 12) , (s + 2)/(s ^2 + 7* s + 12)]
 >> G = C* rsm *B+D
 G =
 5/(s ^2 + 7* s + 12)

The system function obtained matches the result in Example 9.14.

Software resources:

matex_9_6.m

MATLAB Exercise 9.7: Obtaining system function from discrete-time state-space model

Determine the system function for a DTLTI sytem described by the state-space model

x[ n+1 ]=[ 0-0.50.250.75 ]x[ n ]+[ 21 ]r[ n ]y[ n ]=[ 31 ]x[ n ]

Solution: The system function H (z) can be found with the following statements:

  >> A = [0 , -0.5;0.25 ,0.75];
  >> B = [2;1];
  >> C = [3 ,1];
  >> D = [0];
  >> z = sym (’z’);
  >> tmp = z* eye (2) - A;
  >> rsm = z* inv (tmp)
  rsm =
  [(2* z *(4* z - 3))/(8* z ^2 - 6* z + 1), -(4* z)/(8* z^2 - 6*z + 1)]
  [  (2* z)/(8* z ^2 - 6* z + 1), (8* z ^2)/(8* z^2 - 6*z + 1)]
  >> H = C* rsm *B+ D
  H =
  (8* z ^2)/(8* z ^2 -6* z +1) - (8* z)/(8* z ^2 -6* z +1) + (12* z *(4*z -3))/(8* z ^2 -6* z +1)

Software resources:

matex_9_7.m

MATLAB Exercise 9.8: Discretization of state-space model

A state-space model for the RLC circuit in Fig. 9.3 was found in Example 9.1 as

x˙A(t)=[ -2-21-5 ] xa(t)+[ 10 ] rA(t)yA(t)=[ 05 ] xa(t)

The unit-step response of the circuit was determined in Example 9.13 to be

yA(t)=512+703e-3t-1354e-4t,t0

subject to the initial state vector xa (0) = [3 − 2]T. Convert the state-space description to discrete-time, and obtain a numerical solution for the unit-step response using a sampling interval of Ts = 0.1 s.

Solution: The discrete-time state-space model can be computed with the following statements that are based on Eqn. (9.192):

   >> A = [-2,-2;1,-5];
   >> B = [1;0];
   >> C = [0 ,5];
   >> d = 0;
   >> Ts = 0.1;
   >> A_bar = expm (A* Ts)
   A_bar =
   0.8113 -0.1410
   0.0705  0.5998
   >> B_bar = inv (A)*(A_bar - eye (2))* B
   B_bar =
   0.0904
   0.0040
   >> C_bar = C
   C_bar =
    0 5
  >> d_bar = d
   d_bar =
    0

Once coefficient matrix and vectors “A bar”, “B bar”, “C bar”, and “d bar” are created, the output signal can be approximated by iteratively solving the discrete-time state-space model. The script listed below computes the iterative solution for n = 0,..., 30. It also graphs the approximate solution found (red dots) superimposed with the analytical solution found in Example 9.13.

  1 % Script : matex_9_8.m
  2 %
  3 Ts = 0.1;
  4 A_bar = expm (A* Ts);
  5 B_bar = inv (A)*(A_bar - eye (2))* B;
  6 C_bar = C;
  7 d_bar = d;
  8 xn = [3; -2];  % Initial value of state vector
  9 n = [0:30];   % Vector of indices
  10 yn = [];   % Empty vector to start
  11 for nn =0:30 ,
  12  xnp1 = A_bar * xn+ B_bar ;  % ’xnp1 ’ represents x[n+1]
  13  yn = [yn ,C*xn];    % Append to vector ’yn ’
  14  xn = xnp1 ;     % New becomes old for next iteration
  15 end ;
  16 % Graph correct vs. approximate solution.
  17 t = [0:0.01:3];
  18 ya = 5/12+70/3* exp (-3* t) -135/4* exp (-4* t); % From Example 9-13
  19 plot (t,ya , ’b - ’,n*Ts ,yn ,’ro’); grid ;
  20 title (’y_{a}(t) and y[n]’);
  21 xlabel (’t (sec) ’);

The graph is shown in Fig. 9.17.

Figure 9.17

Figure showing Graph obtained in MATLAB Exercise 9.8.

Graph obtained in MATLAB Exercise 9.8.

Software resources:

matex_9_8.m

MATLAB Exercise 9.9: Discretization using Euler method

Consider again the state-space model for the RLC circuit of Fig. 9.3 which was used in MATLAB Exercise 9.9. Convert the state-space description to discrete-time using Euler’s method., and obtain a numerical solution for the unit-step response using a sampling interval of Ts = 0.1 s. The initial state vector is xa (0) = [3 − 2]T.

Solution: The discrete-time state-space model can be computed with the following statements that are based on Eqn. (9.198):

  >> A = [-2,-2;1,-5];
  >> B = [1;0];
  >> C = [0 ,5];
  >> d = 0;
  >> Ts = 0.1;
  >> A_bar = eye (2)+ A*Ts
  A_bar =
  0.8000 -0.2000
  0.1000 0.5000
  >> B_bar = B*Ts ;
  B_bar =
  0.1000
   0
  >> C_bar = C
  C_bar =
   0 5
  >> d_bar = d
  d_bar =
   0

The script listed below computes the iterative solution for n = 0,..., 30. It also graphs the approximate solution found (red dots) superimposed with the analytical solution found in Example 9.13.

 1 % Script : matex_9_9.m
 2 %
 3 Ts = 0.1;
 4 A_bar = eye (2)+ A*Ts ;
 5 B_bar = B* Ts;
 6 C_bar = C;
 7 d_bar = d;
 8 xn = [3; -2];  % Initial value of state vector
 9 n = [0:30];  % Vector of indices
 10 yn = [];   % Empty vector to start
 11 for nn =0:30 ,
 12  xnp1 = A_bar *xn + B_bar ; % ’xnp1 ’ represents x[n+1]
 13  yn = [yn ,C* xn];   % Append to vector ’yn ’
 14  xn = xnp1 ;    % New becomes old for next iteration
 15 end ;
 16 % Graph correct vs. approximate solution.
 17 t = [0:0.01:3];
 18 ya = 5/12+70/3* exp (-3* t) -135/4* exp (-4* t);  % From Example 9-13
 19 plot (t,ya , ’b- ’,n*Ts ,yn ,’ro ’); grid ;
 20 title (’y_{a}(t) and y[n]’);
 21 xlabel (’t (sec)’);

The graph is shown in Fig. 9.18.

Figure 9.18

Figure showing Graph obtained in MATLAB Exercise 9.9.

Graph obtained in MATLAB Exercise 9.9.

The quality of approximation is certainly not as good as the one in MATLAB Exercise 9.8, but it can be improved by reducing Ts.

Software resources:

matex_9_9.m

Problems

  1. 9.1. A continuous-time system is described by the following set of differential equations.

    dx1(t)dt=2x1(t)+2x2(t)-x3(t)+r2(t)dx2(t)dt=-3x1(t)+2x3(t)-r2(t)dx3(t)dt=x1(t)+x2(t)-2x3(t)+r1(t)+r2(t)y1(t)=x1(t)+x3(t)+r1(t)y2(t)=x2(t)+x3(t)+r1(t)

    Write the state-space model of the system in matrix form.

  2. 9.2. Consider the alternative form of the matrix state equation given by Eqn. (9.12):

    x˙(t)=x(t)+B r(t)+Edr(t)dt

    1. Show that this alternative form can be converted to the standard form given by Eqn. (9.7) by defining a new state vector

      z=x-F r(t)

      Express the vector F in terms of A, B and E.

    2. The state-space model for a CTLTI system is

      x˙(t)=[ -13-2-2 ] x(t)+[ 01 ] r(t)+[ 21 ]dr(t)dt

      Convert the state-space model into the standard form by defining a new state vector z (t).

  3. 9.3. Find a state-space model for the circuit shown in Fig. P.9.3. Choose the capacitor voltages νC1 (t) and νC2 (t) as the state variables x1 (t) and x2 (t) respectively.

    Figure P. 9.3

    image

  4. 9.4. Find a state-space model for the RLC circuit shown in Fig. P.9.4. Choose the capacitor voltage νC (t) and the inductor current iL (t) as the state variables x1 (t) and x2 (t) respectively.

    Figure P. 9.4

    image

  5. 9.5. Using the approach taken in Examples 9.3 and 9.4 find a state-space model for each CTLTI system described by a differential equation below:
    1. d2y(t)dt2+3dy(t)dt+2y(t)=2 r(t)
    2. d2y(t)dt2+4dy(t)dt+3y(t)=3 r(t)
    3. d2y(t)dt2-y(t)=r(t)
    4. d3y(t)dt3+6d2y(t)dt2+11dy(t)dt+6y(t)=r(t)
    5. d3y(t)dt3+6d2y(t)dt2+11dy(t)dt+6y(t)=r(t)+2dr(t)dt
  6. 9.6. Find a state-space model for each CTLTI system described below by means of a system function. Use the partial fraction expansion of the system function so that the resulting state-space model has a diagonal coefficient matrix A.
    1. G(s)=2(s+1)(s+2)
    2. G(s)=10s+1(s+2)(s+4)
    3. G(s)=(s-1)(s+4)(s+1)(s+2)(s+3)
  7. 9.7. In Example 9.4 a state-space model was obtained using an ad hoc method for the CTLTI system defined by the differential equation

    d3y(t)dt3+5d2y(t)dt2+11dy(t)dt+15y(t)=3 r(t)+7dr(t)dt

    Obtain a state-space model for the system using a more formal approach by

    1. First finding a system function G (s) for the system.
    2. Deriving a state space model from the system function.
  8. 9.8. A CTLTI system is described by the state-space model

    x˙(t)=[ -43-10 ] x(t)+[ 21 ] r(t)y(t)=[ 31 ] x(t)+(2) r(t)

    1. Find a transformation matrix in the form

      Px=[ 1ab1 ]

      such that the transformation

      x(t)=Pz(t)

      converts the state-space model into Jordan canonical form.

    2. Write the state-space model in terms of the new state vector z (t).
  9. 9.9. Refer to MATLAB Exercise 9.1 in which two different state-space models were obtained for the same system. The first model was

    x˙(t)=[ -6-510 ]x(t)+[ 10 ]r(t)y(t)=[ -5-7 ]x(t)+r(t)

    and the second model was

    z˙(t)=[ 01-5-6 ]z(t)+[ 01 ]r(t)y(t)=[ -7-5 ]z(t)+r(t)

    Show that the second state-space model can be obtained from the first by means of the similarity transformation

    x(t)=[ 0110 ]z(t)

  10. 9.10. Refer to Example 9.1. The state-space model obtained for the RLC circuit in Fig. 9.3 was

    x˙(t)=[ -2-21-5 ]x(t)+[ 10 ]r(t)y(t)=[ 05 ]x(t)+(0)r(t)

    1. Write the state equations in open form. Express dy (t)/dt and d2y (t)/dt2 in terms of the state variables x1 (t) and x2 (t) and the input signal r (t).
    2. Find a second-order differential equation between y (t) and r (t) by eliminating the state variables between the equations for y (t), dy (t)/dt and d2y (t)/dt2.
    3. Using the second-order differential equation obtained in part (b), find an alternative state-space model in phase-variable canonical form.
  11. 9.11. Refer to Problem 9.10. Find a similarity transformation

    x(t)=Pz(t)

    that would transform the original state-space model to the alternative model in phase-variable canonical form that was found.

  12. 9.12. Refer again to Example 9.1 in which a state-space model for the RLC circuit in Fig. 9.3 was found to be

    x˙(t)=[ -2-21-5 ]x(t)+[ 10 ]r(t)y(t)=[ 05 ]x(t)+(0)r(t)

    In this problem we will explore an alternative approach for finding a differential equation between the input and the output signals of the system.

    1. Write the state equations in open form. Take the Laplace transform of each equation (two state equations and one output equation) by making use of linearity and time differentiation properties of the Laplace transform.
    2. Eliminate X1 (s) and X2 (s) to find an equation between Y (s) and R (s). Determine the system function G (s).
    3. Find a differential equation for the system from the system function found in part (b).
  13. 9.13. A CTLTI system with two inputs and two outputs is described by the following pair of differential equations:

    dy1(t)dt=-2y1(t)-y2(t)+r1(t)+r2(t)dy2(t)dt=-3y2(t)+y1(t)+dr1(t)dt

    Following the approach used in Example 9.10 find a state-space model for this system.

  14. 9.14. A CTLTI system with two inputs and two outputs is described by the state-space model

    x˙(t)=[ -12-3-6 ]x(t)+[ 120-1 ]r(t)y(t)=[ -1-320 ]x(t)+[ 014-1 ]r(t)

    1. Using the appropriate similarity transformation, find an equivalent state-space model for this system with a diagonal state matrix.
    2. Using the state-space model found, express output transforms Y1 (s) and Y2 (s) in terms of input transforms R1 (s) and R2 (s).
    3. Using the results found in part (b), write the input-output relationships of the system in the s-domain as

    [ Y1(s)Y2(s) ]=[ G11(s)G12(s)G21(s)G22(s) ][ R1(s)R2(s) ]

  15. 9.15. Refer to Example 9.11 in which the state variables and the output signal of a third-order system were determined in response to unit-step input signal and subject to specified initial conditions. Verify that the solutions found for each of the state variables and the output signal satisfy the state-space model and the initial conditions.
  16. 9.16. A continuous-time system is described by the state-space model

    x˙(t)=[ -320-1 ]x(t)+[ 01 ]r(t)y(t)=[ 11 ]x(t)+r(t)

    The initial value of the state vector is

    x=(0)=[ -23 ]

    Taking advantage of the upper-triangular property of the state matrix determine the output signal in response to a unit-step input signal. Follow the approach taken in Example 9.11.

  17. 9.17. Refer to the system in Problem 9.16.
    1. Using the appropriate similarity transformation, obtain an equivalent state-space model for the system in which the state matrix is diagonal.
    2. Use the alternative state-space model with the diagonal state matrix to determine the output signal in response to a unit-step input signal.
  18. 9.18. Consider the homogeneous state-space model

    x˙(t)=[ -320-1 ]x(t)

    1. Determine the state transition matrix ϕ (t).
    2. Using the initial state vector

      x(0)=[ -23 ]

      and the state transition matrix found in part (a), find x (2), the value of the state vector at time instant t = 2.

    3. Find x (5).
  19. 9.19. The general solution of the continuous-time state-space model can also be obtained using Laplace transform techniques. Let X (s) be the vector that holds the Laplace transform of each state variable.
    1. Take the unilateral Laplace transform of both sides of the state equation given by Eqn. (9.7) taking x (0), the initial value of the state vector, into account.
    2. Solve for X (s) in terms of the Laplace transform R (s) of the input signal.
    3. Take the Laplace transform of the output equation given by Eqn. (9.8) and substitute the solution found for X (s) to obtain the relationship between Y (s) and R (s).
    4. Write the time-domain relationship between the output signal y (t) and the input signal r (t) remembering that

      ϕ(t)=eAt=-1{ [ s I-A ]-1 }

      and that the product of two Laplace transforms corresponds to convolution of the corresponding signals in the time domain.

  20. 9.20. Refer to Example 9.13. Verify that the solutions found for the state variables and the output signal satisfy the state-space model and the specified initial conditions.
  21. 9.21. A state-space model for the RLC circuit of Fig. 9.4 was found in Example 9.2 as

    x˙(t)=[ -2-1260 ]x(t)+[ 10 ]r(t)y(t)=[ -20 ]x(t)+(1)r(t)

    Find the system function G (s) = Y (s)/R (s).

  22. 9.22. Find a state-space model for each DTLTI system described below by means of a difference equation.
    1. y[n] − 0.9 y[n − 1] = r[n]
    2. y[n] − 1.7 y [n − 1] + 0.72 y [n − 2] = 3r [n]
    3. y [n] − y [n − 1] + 0.11 y[n − 2] + 0.07 y [n − 3] = r [n]
  23. 9.23. System functions for several DTLTI systems are given below. Using the technique outlined in Example 9.17 that is based on partial fraction expansion, find a state-space model for each system. Ensure that the matrix A is diagonal in each case.
    1. H(z)=z+1(z+1/2)(z+2/3)
    2. H(z)=z(z+1)(z-0.4)(z+0.7)
    3. H(z)=z(z+1)(z+3/4)(z-1/2)(z-3/2)
  24. 9.24. Consider the system functions given in Problem 9.23. For each system draw a direct-form II block diagram and select the state variables. Then find a state-space model based on the block diagram.
  25. 9.25. Consider the DTLTI systems described below by means of their difference equations. The direct method of finding a state-space model explained in Example 9.16 would be difficult to use in this case, due to the inclusion of delayed input terms r [n − 1], r [n − 2], etc. Find a state-space model for each system in two steps: First find the system function H (z), and then find a state-space model in phase-variable canonical form by inspecting the system function.
    1. y[n] − 0.9 y [n − 1] = r[n] + r [n − 1]
    2. y[n] − 1.7 y[n − 1] + 0.72 y [n − 2] = 3 r [n] + 2r [n − 2]
    3. y [n] − y[n − 1] + 0.11 y[n − 2] + 0.07 y[n − 3] = r [n] − r [n − 1] + r [n − 2]
  26. 9.26. A discrete-time system has the state-space model

    x[ n+1 ]=[ 0-0.50.250.75 ]x[ n ]+[ 21 ]r[ n ]y[ n ]=[ 31 ]x[ n ]

    The initial value of the state vector is

    x[ 0 ]=[ 20 ]

    The input to the system is a unit-step function, that is, r[n] = u[n]. Iteratively solve for the output signal y[n] for n = 0,..., 3.

  27. 9.27. A discrete-time system is described by the state-space model

    x[ n+1 ]=[ -0.1-0.7-0.80 ]x[ n ]+[ 31 ]r[ n ]y[ n ]=[ 2-1 ]x[ n ]

    1. Find the resolvent matrix Φ (z).
    2. Find the state transition matrix ϕ [n].
    3. Compute the unit-step response of the system using the initial state vector

      x[ 0 ]=[ 20 ]

  28. 9.28. A discrete-time system is described by the state-space model

    x[ n+1 ]=[ -0.1-0.7-0.80 ]x[ n ]+[ 31 ]r[ n ]y[ n ]=[ 2-1 ]x[ n ]

    Find the system function H (z).

MATLAB Problems

  1. 9.29. A DTLTI system has the system function

    H(z)=z3-7z+6z4-0.2z3-0.93z2+0.198z+0.1296

    Develop a MATLAB script to do the following:

    1. Use function tf2ss(..) to find a state-space model.
    2. Use function eig(..) to find a transformation matrix P that converts the state-space model found in part (a) to one with a diagonal state matrix.
    3. Obtain an alternative state-space model using the transformation matrix P found in part (b).

    Caution: The use of the function tf2ss(..) with discrete-time system functions requires some care. Write the numerator and the denominator of the system function as polynomials of z−1, and then set up vectors for numerator and denominator coefficients for use with the function tf2ss(..).

  2. 9.30. Refer to the system described in Problem 9.26. Write a script to compute and graph the unit-step response of the system for n = 0,..., 99 using the iterative method.
  3. 9.31. Refer to the system in Problem 9.27. Write a script to determine the unit-step response of the system using symbolic mathematics functions of MATLAB. Verify the analytical solution found in Problem 9.27.
  4. 9.32. Refer to the system in Problem 9.28. Write a script to determine the system function H (z) using symbolic mathematics functions of MATLAB. Verify that it matches the solution found manually in Problem 9.28.
  5. 9.33. Repeat MATLAB Exercise 9.9 using a sampling interval of T = 0.02 s. Simulate the system for 0 ≤ t ≤ 3 s. Graph the approximated output signal against the analytical solution found in Example 9.13.
  6. 9.34. Consider the system a state-space model for which was found in Example 9.3.
    1. Find a discrete-time state-space model to approximate this system using the technique outlined in Eqns. (9.187) through (9.192). Use a sampling interval of Ts = 0.1 s.
    2. Using the discretized state-space model found, compute an approximation to the unit-step response of the system. Assume zero initial conditions.
  7. 9.35. Consider the system a state-space model for which was found in Example 9.4.
    1. Find a discrete-time state-space model to approximate this system using Euler’s method with the sampling interval of Ts = 0.1 s.
    2. Using the discretized state-space model found, compute an approximation to the unit-step response of the system. Assume zero initial conditions.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset