Beruflich Dokumente
Kultur Dokumente
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
x1 (t ) = (t )
x 2 (t ) = &(t )
g
x& 2 = sin( x1 )
L
2. Equilibrium
x& 2 (t ) = f 2 ( x1 , x 2 , t )
f 2 ( x1 , x 2 , t ) =
g
sin x1
L
0 = f 2 ( x1( r ) , x2( r ) , t )
x1(1) = 0
x 2(1) = 0
2 : x1( 2) =
x2(1) = 0
1:
3. Linearization
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
y 2 (t ) = x2 (t ) x 2( r )
y&1 (t ) = y 2 (t ), y& 2 (t ) =
g
y1 (t ).
L
g
y1 (t ).
L
d nx
dt n
dx d 2 x d n1 x
= f ( x, , 2 ,... n1 , t )
dt dt
dt
x1 = x
dx
x2 =
dt
x3 =
d 2x
dt 2
,L
xn =
d n1 x
dt n1
dx(0)
x1 (0) = x(0) x 2 (0) =
dt
x 3 ( 0) =
d 2 x ( 0)
dt 2
, L x n ( 0) =
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
x& (t ) = f ( x, t )
(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
Figure 2 1: f versus t
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 )
(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)
x r = f r T
(r = 1, 2, L n)
x r (t + T ) = x r (t ) + x r
(r = 1, 2, L n)
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
(2 20)
x(t + T ) = x(t ) + x
f (T ) 2
f
x = fT + f +
t 2
x
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 )
f ( x + x (1) , t + T )
f
f
x (1) + T + ...
x
t
f
f
= f + f + T + ...
t
x
= f ( x, t ) +
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
x (1) = f ( x, t )T
x = [ f ( x, t ) + f ( x + x (1) , t + T )]
T
2
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
% 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)
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;
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
y1 = 1e st , y 2 = 2 e st .
MAE 461: DYNAMICS AND CONTROLS
3.5
4.5
Thus,
s = i
g
=0
L
= g/L
g
=0
L
g
s 2 = 0,
L
from which
s =
= g/L
(2 29)
y1 = Aet + Be t
x1 (t )
x
(
t
)
2
x(t ) =
M
x
(
t
)
n1
x (t )
n
(2 31)
x& (t ) = f (x, t )
(2 32)
0 = f (x 0 , t )
0=
f (x (0r ) , t )
(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
(2 34)
y = x x0
(2 35)
y& = Ay
A=(
f T
)
x 0
(2 36)
y = e t
1
= 2
M
n
(2 37)
= A
det[ I A] = 0
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
&& + C& + K = 0
in which
K=
3k
M
C=
3c
M
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
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
(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
y&1 = y 2
y& 2 =
3k
3c
y1
y2
M
M
0
A = 3k
M
1
3c
M
0 = det[I A] = det 3k
M
3c
3k
= 2 + +
M
M
1
3c
+
M
y = A1 1 e 1t + A2 1 e 2t
2 1
2 2
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
(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
/ 18
1 + i
1 / 18
=
1 0 36 1 i
36
e 0.1t [2 cos( 99 )t
0.2
sin( 99 )t ]
.99
0.1
0.99
0.1
0.99
30
nonlinear - Euler
nonlinear - Runga-Kutta
20
linear - Runga-Kutta
10
-10
-20
-30
0
10
PROBLEM STATEMENTS