Sie sind auf Seite 1von 29

CONVERTING TO THE STATE SPACE

2
CONVERTING TO THE
STATE SPACE
Differential equations can be solved analytically
when the equations are linear and when the
nonlinearities are relatively simple. Otherwise, the
equations need to be solved numerically. To solve
the equations numerically, the differential
equations are converted to a standard format. The
standard format is a set of 1st-order nonlinear
differential equations, called state equations. The
equations are converting to a standard format to
produce a corresponding numerical procedure that
is standardized, as well.
1. Nonlinear State Equations
The single degree-of-freedom of the pendulum is
associated with the pendulums configuration. For
this reason, the linearization described in the
previous chapter is sometimes referred to as being
carried out in the configuration space. In contrast,
well momentarily carry out the linearization in the
state space. The pendulums state consists of the
angle (t) and its angular rate &(t ). Once (t) and
&(t ) are prescribed as initial conditions, the future
state of the system can be predicted which is

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

why the term state is used. The pendulums state


variables are
(2 1)

x1 (t ) = (t )

x 2 (t ) = &(t )

From Eq. (1 3), the two state equations that


describe the motion of the pendulum are expressed
in terms of its state variables as
(2 2)
x&1 = x2

g
x& 2 = sin( x1 )
L

Equations (2 2) are two 1st-order differential


equations. The first of the two equations defines
x2(t) as the time derivative of x1(t) and the second
of the two equations is the equation of motion
coming from Eq. (1 3). So, one 2nd-order
differential equation has been converted into two
1st-order differential equations.
The benefit of the state format is a matter of
standardization. Just about any differential
equation or system of differential equations, not
just 2nd-order differential equations, can be
converted into a system of 1st-order equations. In
fact, the state format is not only used for numerical
integration, but in all kinds of methods of analysis
and design. Control methods, filtering techniques,
estimation procedures, to name a few, have been
standardized for state equations. These methods
are called state variable methods.
Lets now retrace our steps and re-develop the
material previously covered in Chapter 1 using this
new state-variable format.

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

2. Equilibrium

First rewrite the state equations (2 1) in the


general functional form
(2 2)
x&1 (t ) = f1 ( x1 , x 2 , t )

x& 2 (t ) = f 2 ( x1 , x 2 , t )

In the case of the pendulum, the right sides of Eq.


(2 2) are
(2 3)
f1 ( x1 , x 2 , t ) = x 2

f 2 ( x1 , x 2 , t ) =

g
sin x1
L

In terms of the state variables, the equilibrium


state is found by substituting
x&1 = 0 and x& 2 = 0
into Eq. (2 2) to get
(2 4)
0 = f1 ( x1( r ) , x2( r ) , t )

0 = f 2 ( x1( r ) , x2( r ) , t )

where x1( r ) and x 2(r) denote the r-th equilibrium


state (r = 1, 2). The pendulums two equilibrium
states are
(2 5)

x1(1) = 0

x 2(1) = 0

2 : x1( 2) =

x2(1) = 0

1:

3. Linearization

Next, lets linearize the state equations (2 2)


about each of the equilibrium states. Expanding the
functions f1 and f 2 in Taylor series about each of
MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

the equilibrium states (r = 1, 2), and retaining only


linear terms, yields
(2 6)

f1 ( x1 , x2 , t ) = (

f1
f
) 0 ( x1 x1( r ) ) + ( 1 ) 0 ( x2 x2( r ) ),
x2
x1

f 2 ( x1 , x2 , t ) = (

f 2
f
) 0 ( x1 x1( r ) ) + ( 2 ) 0 ( x2 x2( r ) ).
x1
x2

Lets also redefine the state variables to be relative


to each of the equilibrium states (r = 1, 2). We
define the new state variables
(2 7)
y1 (t ) = x1 (t ) x1( r )

y 2 (t ) = x2 (t ) x 2( r )

Next, substitute the Taylor series approximations


into Eq. (2 2), evaluate the partial derivatives at
the first equilibrium state, and obtain the linearized
state equations
(2 8)

y&1 (t ) = y 2 (t ), y& 2 (t ) =

g
y1 (t ).
L

Equations (2 8) describe the pendulums state in


the neighborhood of the first equilibrium state.
Next, evaluate the partial derivatives at the second
equilibrium state and obtain the linearized state
equations
(2 9)
y&1 (t ) = y 2 (t ), y& 2 (t ) = +

g
y1 (t ).
L

Equations (2 - 9) describe the pendulums state in


the neighborhood of the second equilibrium state.

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

The n-th Order Differential Equation


Lets see how an nth-order differential equation is
converted to state equations. The nth-order
differential equation is
(2 10)

d nx
dt n

dx d 2 x d n1 x
= f ( x, , 2 ,... n1 , t )
dt dt
dt

in which f is any function of x, its time derivatives


up to the n-1-th time derivative, and time. In order
to predict x(t), initially, the position x(0) and its
dx(0) d 2 x(0) d n1 x(0)
time derivatives
,
,...
are
dt
dt n1
dt 2
needed. To convert Eq. (2 10) and the initial
conditions into state equations and an initial state,
introduce the state variables
(2 11)

x1 = x

dx
x2 =
dt

x3 =

d 2x
dt 2

,L

xn =

d n1 x
dt n1

The initial state variables are


(2 12)

dx(0)
x1 (0) = x(0) x 2 (0) =
dt

x 3 ( 0) =

d 2 x ( 0)
dt 2

, L x n ( 0) =

Differentiate Eq. (2 11) with respect to time,


considering Eq. (2 10), to get the state equations
(2 13)

x&1 = x2
x& 2 = x3
M

x& n1 = xn
x& n = f ( x1 , x2 ,L xn , t )
MAE 461: DYNAMICS AND CONTROLS

d n1 x(0)
dt n1

CONVERTING TO THE STATE SPACE

4. The Euler Method (1stOrder Numerical


Integration)

The 1storder numerical integrator is developed


below, first, for one state equation and then for n
state equations. The implementation of the
integrator in a computer program is discussed in
section 6.
One State Equation
The single state equation is
(2 14)

x& (t ) = f ( x, t )

Lets predict x(t + T) from x(t) in which T is a


time step. To make the prediction, a Taylor series
expansion of x(t) is performed.
(2 15)

(T ) 2
+L
x(t + T ) = x(t ) + x& (t )T + &x&(t )
2!
The first term on the right side is called a 0thorder
term, the next term is a 1st order term, the next is
a 2nd-order term, etc. As a simple approximation,
we retain the first two terms on the right side and
neglect the others. This is called a 1st-order
approximation. By neglecting the 2nd- and higherorder terms, we get
(2 16)

x = f T
x(t + T ) = x(t ) + x

Equation (2 16) is the 1st order numerical


integrator for Eq. (2 14). Its called the Euler
algorithm. Equation (2 16) is used in a computer
program in a loop that predicts x(t) at times T, 2T,
3T, etc. Figure 2 1 shows the error in the
MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

prediction over one time step. As you might


expect, the error decreases as the time step
decreases.

Figure 2 1: f versus t

A System of State Equations


Lets now extend the 1storder numerical
integrator to a set on n state equations. The set of n
state equations is
(2 17)

x&1 (t ) = f1 ( x1 , x 2 , L , x n , t )
x& 2 (t ) = f 2 ( x1 , x 2 , L , x n , t )
M
x& n (t ) = f n ( x1 , x 2 , L , x n , t )

To predict the states x1(t + T), x2(t + T), , xn(t


+ T) from the states x1(t), x2(t), , xn(t), we
perform Taylor series expansions of each of the
state variables.

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

(2 18)
x r (t + T ) = x r (t ) + x& r (t )T + &x&r (t )

(T ) 2
+L
2!

(r = 1, 2, L , n)

Neglecting the 2nd-order and higher-order terms


(2 19)

x r = f r T
(r = 1, 2, L n)
x r (t + T ) = x r (t ) + x r
(r = 1, 2, L n)

Equation (2 19) is the 1storder numerical


integrator for Eq. (2 17). Figure 1 applies to each
of the state variables showing the errors in the state
variables over one time step.
5. The 2ndOrder RungaKutta Method
(2ndOrder Numerical Integration)

The 2ndorder numerical integrator is more


accurate than the 1st-order numerical integrator. It
is developed below, first, for one state equation,
and then for n state equations.
One State Equation
Start with Eq. (2 14) and the Taylor series
expansion of x(t) in Eq. (2 15). The 2nd-order
numerical integrator retains the first three terms on
the right side of Eq. (2 15) (up to the 2nd-order
term) and neglects the remaining ones. When
implemented in an algorithm, the x& (t ) term on the
right side of Eq. (2 15) is replaced with f per Eq.
(2 14). The immediate question is what to do
with the &x&(t ) term. By differentiating Eq. (2 14),
the &x&(t ) term is

f
f
f
1 f
df
&x&(t ) = f& ( x, t ) =
f +
= ( dx + dt ) =
t
x
t
dt dt x
so the algorithm can be written as
MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

(2 20)

x(t + T ) = x(t ) + x
f (T ) 2
f
x = fT + f +
t 2
x

This form of the algorithm can be used when


f
f
are made
and
explicit expressions for
t
x
available to the computer program. However, this
is generally not done. The more convenient option
f
f
is to manipulate the algorithm so that
and
t
x
are not needed explicitly. The strategy is to
perform two evaluations of f; one at time t and the
other at time t +T. In this spirit, we propose an
algorithm for x in the two-evaluation form
(2 21)
x = f ( x, t ) + f ( x + x (1) , t + T )

The evaluation of f at time t + T can not be made


exactly because we dont yet know x at time t
+ T. After all, a better approximation of x at
time t +T is precisely what is sought. So, we use
the 1st-order approximation of x found earlier,
denoted by x (1) , to evaluate f at time t + T.
From Eq. (2 16), the 1st-order approximation of
x is
(2 22)

x (1) = f ( x, t )T
To implement Eq. (2 21) in an algorithm we
need to find the coefficients and . To find them,
perform a two-variable Taylor series expansion of
f ( x + x (1) , t + T )

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

f ( x + x (1) , t + T )
f
f
x (1) + T + ...
x
t
f
f
= f + f + T + ...
t
x
= f ( x, t ) +

Next, truncate this expansion past the 1st-order


term, substitute it into Eq. (2 21), and compare
the result with Eq. (2 20):
(2 23)
2

f (T )
f
=
fT + f +
t 2
x
f

f
f + f + f + T
t
x

f
f
By equating factors in front of f and f +
t
x
on both sides of Eq. (2 23) the coefficients and
are found to satisfy
(2 24)
T = +

T
2

Therefore, the 2nd-order numerical integrator is


(2 25)

x (1) = f ( x, t )T
x = [ f ( x, t ) + f ( x + x (1) , t + T )]

T
2

The 2ndorder numerical integrator is also called


the 2ndorder Runga-Kutta algorithm.
The 2nd-order numerical integrator is more
accurate than the 1st-order numerical integrator.
Both numerical integrators become more accurate
when the time step is decreased, but this increases
MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

the number of calculations needed for the


numerical integration. In many problems, the 2ndorder numerical integrator is adequate, but not
always. Although beyond the scope of these notes,
there is a 4th-order Runga-Kutta algorithm that is
more accurate than the 2nd-order Runga-Kutta
algorithm and there is even a 5th-order RungaKutta algorithm that is still more accurate. The 5thorder Runga-Kutta algorithm is made efficient
through a variable time step.
A System of State Equations
The steps followed to develop the 2ndorder
numerical integrator for a set of n state equations
are the same as the steps followed to obtain the
2ndorder numerical integrator for one state
equation. Following these steps (the details are not
provided here), one obtains
(2 26)

x r(1) = f r ( x1 , x 2 , L x n , t )T

(r = 1, 2, L n)

x r = [ f r ( x1 , x 2 , L x n , t ) +
+ f r ( x1 + x1(1) , L x n + x n(1) , t + T )

]2T

(r = 1, 2, L n)
6. Computer Programming

Good programming habits prevent you from


spending excessive time on trouble-shooting
errors. The computer program that is used to solve
state equations naturally divides into three parts
regardless of the computer programming language.
The first part is the main program. It performs the
iterations and plots the results. The second part
contains the state equations. The third part
contains the numerical integrator. Keeping these
MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

three parts separate is helpful because its easier to


trouble-shoot a segment of code than all of it
together. Youll be able to use this format in most
of the computer assignments (This is a sort-of
separation principle for programming).
As an example, the free response of the massspring-damper system shown in Fig. 2 2 is found
using:
name.m
main program, and
name_state.m state equations, and
step1.m 1st-order numerical integrator, or
step2.m 2nd-order numerical integrator

The main program is shown in Fig. 2 3(a). As


shown, the integration parameters are specified
(deltaT and N), the initial conditions are
specified, the states are updated, and the time
response is graphed. The system parameters and
the state equations are given in name_state.m,
as shown in Fig. 2 3(b). The states are updated
using the 1st-order numerical integrator step1.m
shown in Fig. 2 3(c) or the 2nd-order numerical
integrator step2.m shown in Fig. 2 4(d).

Figure 2 2: Mass-spring-damper system

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

% name.m
% This program determines the state variables of the
% following mass-spring-damper system:
%
% m(d2x/dt2)+c(dx/dt)+kx = 0
% x(0) = 1; dx/dt(0) = 0,
% m = 1; c = 2; k = 5
%
% This program graphs x(t).
% The state equations are contained in the M-file
% called name_state.m
clear
%
% perform 1st-order numerical integration
%
x(1) = 1; x(2) = 0;
% initial condtitions
deltaT = 0.01; N = 500; % step size and number of steps
for i = 1:N
t = (i-1)*deltaT;
xnew = step1('name_state',x,t,deltaT);
xgraph(i) = x(1);
time(i) = t;
x = xnew;
end
figure
% graph y(x)
hold
grid
plot(time,xgraph,'--')
%
% perform 2nd-order numerical integration
%
x2(1) = 1; x2(2) = 0;
% initial conditions
for i = 1:N
t2 = (i-1)*deltaT;
xnew2 = step2('name_state',x2,t2,deltaT);
xgraph2(i) = x2(1);
time2(i) = t2;
x2 = xnew2;
end
%
% graph y(x)
%
plot(time2,xgraph2)

Figure 2 3(a): name.m


MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

function f = name_state(x,t)
% function f = name_state(x,t)
% This M-file lists the state equations.
% INPUTS
% x(t)
n x 1 vector of state variables at time t
% t
time
% OUTPUTS
% f(x,t) n x 1 vector of time derivatives of state variables
%
% Free mass-spring-damper system
%
m = 1; c = 2; k = 50;
% system parameters
f(1) = x(2);
f(2) = (-c*x(2)-k*x(1))/m;

Figure 2 3(b): name_state.m


function xnew = step1(file, x, t, deltaT)
% function xnew = step1(file, x, t, deltaT)
% This M-file performs a 1st-order numerical integration step.
% INPUTS
% file
name of the file that contains the state equations
% x
n x 1 vector of state variables at time t
% t
time
% deltaT time step
% OUTPUTS
% xnew
n x 1 vector of state variables at time t + deltaT
% CALLS
% M-file
%
eval(['f = ',file,'(x, t);'])
deltax = deltaT*f;
xnew = x + deltax;

Figure 2 3(c): step1.m

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

function xnew = step2(file,x,t,deltaT)


% function xnew = step2(file,x,t,deltaT)
% This M-file performs a 2nd-order numerical integration step.
% INPUTS
% file
name of the file that contains the state equations
% x
n x 1 vector of state variables at time t
% t
time
% deltaT time step
% OUTPUTS
% xnew
n x 1 vector of state variables at time t + deltaT
% CALLS
% M-file
%
eval(['f1 = ',file,'(x,t);'])
deltax1 = deltaT*f1;
eval(['f2 = ',file,'(x + deltax1,t + deltaT);'])
xnew = x + 0.5*deltaT*(f1 + f2);
Figure 4: (d) step2.m
The time response x(t) obtained using step1.m
and the time response x(t) obtained using
step2.m are shown in Fig. 2 4. The difference
between the graphs is a result of numerical error in
the Euler algorithm. As a practical matter, the
numerical integrators do not change from problem
to problem, so they dont need to be debugged.

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

0.8

0.6

0.4

x(t)

0.2

-0.2

-0.4

-0.6

-0.8

0.5

1.5

2.5
time

Figure 2 4: Graph of x(t) obtained using


step1.m (dashed line) and step2.m (solid
line)
7. Stability

In this section we see how to solve state equations


analytically and then how stability is determined in
the state space. In particular, we solve Eq. (2 8)
and Eq. (2 9) and determine the stability
characteristics of each of the pendulums
equilibrium states (although we all ready know the
answer to this). Start by trying a solution to Eq. (2
8) in the complex form
(2 27)

y1 = 1e st , y 2 = 2 e st .
MAE 461: DYNAMICS AND CONTROLS

3.5

4.5

CONVERTING TO THE STATE SPACE

Substitute Eq. (2 27) into Eq. (2 8), and divide


by est to get
g
s1 = 2 and s 2 = 1
L

from which we find that


s2 +

Thus,
s = i

g
=0
L

= g/L

By the principle of linear superposition, and from


Eq. (2 27), it now follows that the general
solution in the neighborhood of the first
equilibrium state is
(2 28)
y1 (t ) = A1e it + A2 e it

= A1 (cos t + i sin t ) + A2 (cos t i sin t )


= A cos cos t + B sin t
for some constant A and B. Notice that y1(t) is
harmonic and hence stable (y2(t) is harmonic, too).
Turning to the second equilibrium state, substitute
Eq. (2 27) into Eq. (2 9) and divide by est to get
s2

g
=0
L
g
s 2 = 0,
L

from which
s =

= g/L

By the principle of linear superposition, and from


Eq. (2 27), it now follows that the general
solution in the neighborhood of the second
equilibrium state is

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

(2 29)

y1 = Aet + Be t

Of course, this is an unbounded response and


hence unstable (y2(t) is unbounded, too).
8. Vector Methods

The developments presented in the previous


sections can be presented a little differently, with
the aid of matrix-vector notation. The use of
matrix-vector notation allows us to further
generalize from two states to any number of states.
The following re-develops the equations developed
in the first 3 sections and section 7 of this chapter,
the difference being that the quantities will all be
expressed in vector-matrix form. Begin by
defining the state vector as
(2 30)

x1 (t )

x
(
t
)
2

x(t ) =
M

x
(
t
)
n1
x (t )
n

The nonlinear state equations (2 2) are written as

(2 31)

x& (t ) = f (x, t )

and the equilibrium equation, Eq. (2 4), becomes

(2 32)
0 = f (x 0 , t )

0=

f (x (0r ) , t )

The Taylor series expansion of f, Eq. (2 6), in


matrix-vector form is
MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

(2 33)
f (x, t ) = (

f T
) 0 (x x 0 )
x

in which

f1
x
1
f
f 1
= x
x 2
M

f1
x n

f 2
x1
f 2
x 2
M
f 2
x n

f n
x1

f n
L
x 2
M

f n
L
x n
L

We now redefine the state vector to be relative to


each of the equilibrium state vectors (r = 1, 2).
Like Eq. (2 7), the new state vector is

(2 34)

y = x x0

Substituting Eq. (2 - 34) and the Taylor series


approximation of f into Eq. (2 31) yields, like
Eq. (2 8) and Eq. (2 9), the linearized state
equations

(2 35)
y& = Ay

A=(

f T
)
x 0

As we did in Eq. (2 27), the solution to Eq. (2


35) is found by trying a solution in the form

(2 36)
y = e t

1


= 2
M

n

Substituting Eq. (2 36) into Eq. (2 35) yields


MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

(2 37)

= A

Equation (2 - 37) is called the eigenvalue


problem. The vector is called an eigenvector
and is called an eigenvalue. The eigenvalue
problem, Eq. (2 37), can also be rewritten as
[ I A] = 0
where I denotes the n n identity matrix. Notice if
the inverse of the matrix in brackets were to exist
then = 0 would be the only solution. On the other
hand, if the inverse of the matrix in brackets does
not exist, nontrivial solutions exist. The inverse of
the matrix in brackets does not exist if its
determinant is zero, that is, if
(2 38)

det[ I A] = 0

Equation (2 38) is called the characteristic


equation of the matrix A. Its an nth-order
polynomial that admits n eigenvalues. Once the
characteristic equation is solved, the eigenvalues
are substituted back into Eq. (2 37) to determine
the corresponding eigenvectors.
By the principle of linear superposition, any linear
combination of the solutions given in Eq. (2 36)
solves the linearized state equations, Eq. (2 35),
so the general solution is
(2 39)
y (t ) = 1 A1e 1t + 2 A2 e 2t + L + + n An e nt
Equation (2 39) solves Eq. (2 35) and A1, A2,
An are complex coefficients that depend on
initial conditions. Equation (2 39) reveals the
following general statement about stability:
MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

The linearized system is stable if Re{r } 0, r = 1, 2,L, n .


If Re{r } > 0 for any one the eigenvalues, then the
system is unstable. If follows that:

A stability region is stable if Re{r } 0,


r = 1, 2,L, n . If Re{r } > 0 for any one the
eigenvalues, the stability region is unstable.
This is how, in general, the stability of a region can
be determined, and how linear state equations, Eq.
(2 35), can be solved analytically.

A Second Example
Consider the Second Example described in
Chapter 1 of an elbow. Its nonlinear differential
equation was found to be
(a)

&& = f ( , &)
in which
k
1
3c (sin + cos ) 2 &
f ( , &) = 3 (1

)(cos sin )
M
M 3 + 2 sin 2 cos
3 2 cos 2 sin

Its first equilibrium position was 0(1) = 0 and the linearized


equation about the first equilibrium position was found to be
(b)

&& + C& + K = 0
in which
K=

3k
M

C=

3c
M

Assume that the elbow is initially rotated 30o and


released from rest. This places the elbow in the
neighborhood of the first equilibrium position
making the linearized equation (b) potentially a
good approximation of the nonlinear differential
equation (a). To illustrate the earlier developments,
MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

lets find the elbows nonlinear state equations, its


linear state equations in the neighborhood of the
first equilibrium state, the characteristic equation,
the systems eigenvalues, and a general form of the
systems linearized response. Then, well compare
(a) the linearized response obtained in closedform, (b) the nonlinear response by the Euler
method, and (c) the nonlinear response by the
Runga-Kutta method.
We first find the nonlinear state equations. Define
the states as x1 (t ) = (t ) and x2 (t ) = &(t ) .Then, the
nonlinear state equations of the elbow become
(c)

x&1 (t ) = x2 (t )
x& 2 (t ) = f ( x1 (t ), x2 (t ))

in which

f ( x1 , x2 ) = 3

k
1
3c ( s 0 + c0) 2
(1
)(c0 s 0)
x2
M
M 3 + 2 s 0 2c 0
3 2c 0 2 s 0

letting c0 = cos( x1 ) and s 0 = sin( x1 ).


Next, we find the linear state equations from Eq. (2
6). The needed partial derivatives evaluated at
the first equilibrium state are:
(d)

f1 x2
f1 x2
=
=0
=
=1
x1 x1
x2 x2
f 2 f
3k
=
=
x1 x1
M

f 2
f
3c
=
=
x2 x2
M

It follows that

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

(e)
f1 =

f1
f
( x1 0) + 1 ( x2 0) = (0) y1 + (1) y 2 = y 2
x1
x 2

f2 =

f 2
f
3k
3c
( x1 0) + 2 ( x 2 0) = y1
y2
x1
x2
M
M

The linear state equations in the neighborhood of


the first equilibrium state become
(f)

y&1 = y 2
y& 2 =

3k
3c
y1
y2
M
M

In matrix form, these equations have the form of


Eq. (2 35):
(g)
y& = Ay

0
A = 3k
M

1
3c

M

Next, lets find the characteristic equation, Eq. (2


38). From (g)
(h)

0 = det[I A] = det 3k
M
3c
3k
= 2 + +
M
M

1
3c
+
M

The characteristic equation has two roots; so there


are two corresponding solutions: e 1t and e 2t . The
general form of the linearized response is:
(i)



y = A1 1 e 1t + A2 1 e 2t
2 1
2 2

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

Lets now compare three responses: (a) the


linearized response obtained in closed-form, (b)
the nonlinear response by the Euler method, and
(c) the nonlinear response by the Runga-Kutta
method. Toward this end, let
3c
3k
= 0.2
= 1.0
M
M

The eigenvalues are found from the characteristic


equation; the eigenvalues are
1
2

1,2 = (0.2 (0.2 2 4)1 / 2 ) = 0.1 i .99


The eigenvectors are found from the eigenvalue
problem Eq. (2 37). Thus
1, 2
3k

1
1, 2
3c =
1,2 + 2 1, 2 1
M

1 1
0


=
1, 2 + 0.2 2 1, 2 0

and thus
1
1
1

=
=
0.1 i .99

1
,
2

2 1, 2

The general form of the linear response, Eq. (i) is
then:
(j)
1

( 0.1+i
e
y = A1
i
0
.
1
.
99

1

(i
e
= e 0.1t A1
i
0
.
1
.
99

( 0.1i .99 )t
e
+ A2
i
0
.
1
.
99

( i .99 )t
.99 )t
e
+ A2

i
0
.
1
.
99

.99 )t

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

Next, use the identity e i ( a ) = cos(a ) i sin( a) to


reduce (j) to
(k)
1

(cos( 99 )t + i sin( 99 )t ) +
y = e 0.1t A1

+
0
.
1
i
.
99

(cos( 99 )t i sin( 99 )t )
A2
0.1 i .99

( A1 + A2 ) cos( 99 )t + i ( A1 A2 ) sin( 99 )t

= e 0.1t

+
+

A
)
cos(
99
)
t
i
(

A
)
sin(
99
)
t
1 1

2 2
1 1
2 2
From the initial conditions:
1
/ 18 A1 + A2
=
=
y =
0 1 A1 + 2 A2 0.1 + i 0.99

A1

0.1 i 0.99 A2
1

so

1
A1
=
A2 0.1 + i 0.99
=

0.1 i 0.99

0.1 i 0.99
1

2i 0.99 0.1 i 0.99

/ 18

1 + i
1 / 18
=

1 0 36 1 i

The general form of the linear response is then


y1 = e 0.1t [( A1 + A2 ) cos( 99 )t + i ( A1 A2 ) sin( 99 )t ]
=

36

e 0.1t [2 cos( 99 )t

0.2
sin( 99 )t ]
.99

The stable response in this case was a


superposition of two complex exponential
functions; this is called an under-damped
MAE 461: DYNAMICS AND CONTROLS

0.1

0.99
0.1

0.99

CONVERTING TO THE STATE SPACE

response. The different types of stable responses


will be described in detail in Chapter 3.
Now that we have developed the nonlinear state
equations and the response of the linearized
system, we can make the desired comparisons.

30

nonlinear - Euler
nonlinear - Runga-Kutta
20

linear - Runga-Kutta

10

-10

-20

-30
0

Figure 2 5: Response of the Elbow


Figure 2 5 shows the response (t) obtained 4
different ways: by integrating the nonlinear
equations using the Euler method, by integrating
the nonlinear equations using the Runga-Kutta
method, by integrating the linear equations by the
Runga-Kutta method and by graphing the closedform response of the linearized system.
The response of the linearized system by the
Runga-Kutta method and the graph of the closedMAE 461: DYNAMICS AND CONTROLS

10

CONVERTING TO THE STATE SPACE

form response of the linearized system are on top


of each other. This is because the Runga-Kutta
method, with the chosen step size, is extremely
accurate.
The response of the nonlinear system by the Euler
method and the response of the nonlinear system
by the Runga-Kutta method differ from each other.
This is attributed to the inaccuracy of the Euler
method. Notice that the error is a propagating error
(grows in time) and that the response of the
nonlinear system by the Euler method is less
damped than the response by the Runga-Kutta
method. This means that the nature of the error in
the Euler method is to decrease the level of
damping in the system. If the system had originally
been undamped, the error would have caused the
response of the system to appear to be unstable
oscillating with growing amplitude.

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

PROBLEM STATEMENTS

The problems in this chapter consider systems 1


1 through 1- 7. Set the applied moment and the
applied force to zero. Assume that the system is
initially at rest and that the initial angle is 10
larger than the first equilibrium angle. This places
the system in the neighborhood of the first
equilibrium position.
Problem 2 1: Analytical Response
This problem begins where Problem 1 3 ends.
Assume that the system is initially at rest, and that
the initial angle is 10 larger than the first
equilibrium angle. This places the system in the
neighborhood of the first equilibrium position.
Determine the response of the system (t) in the
following ways:

(a) Use the linear differential equations you


found in Problem 1 3 to find the (t) analytically.
Using MATLAB, plot (t) showing it for about 6
oscillations.
Problem 2 2: The Euler Method
This problem begins where Problem 1 1 ends.
(a) Rewrite the nonlinear differential equation
as two first-order nonlinear differential equations
(state equations).
(b) Use the Euler Method to numerically
integrate the state equations. Using MATLAB,
write a short program to do the integration (do not
use a canned code) and plot (t) for about 6
oscillations. Use a step size of about 0.005Tf
where Tf is the systems fundamental period.
(c) Compare the analytical response in Problem
2 1 with the response obtained here (overlap the
graphs). Describe what accounts for the
differences between the responses obtained in (a)
and (c)?

MAE 461: DYNAMICS AND CONTROLS

CONVERTING TO THE STATE SPACE

Problem 2 3: The 2nd-Order Runga-Kutta


Method
This problem begins where Problem 2 2 ends.

(a) Use the 2nd-order Runga-Kutta method to


numerically integrate the state equations. Use the
same step size as in Problem 2 2. Write a
program in MATLAB to do this and plot your
results.
(b) Use the 2nd-order Runga-Kutta method to
numerically integrate the linearized state
equations. Use the same step size as in Problem 2
2. Write a program in MATLAB to do this and
plot your results.
(c) Compare these results with the two graphs
obtained in Problem 2 1 and Problem 2 - 2.
Describe what accounts for the differences among
the three responses.

MAE 461: DYNAMICS AND CONTROLS

Das könnte Ihnen auch gefallen