0% found this document useful (0 votes)
36 views96 pages

0005 State-Space Approach

Uploaded by

Rana Wael
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views96 pages

0005 State-Space Approach

Uploaded by

Rana Wael
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 96

CHAPTER 5

state-space approach to
modeling dynamic systems

Dr. Bahaa Nasser

1
Contents
5-1 INTRODUCTION
5-2 TRANSIENT-RESPONSE ANALYSIS OF
SYSTEMS IN STATE-SPACE FORM WITH
MATLAB
5-3 STATE-SPACE MODELING OF SYSTEMS
WITH NO INPUT DERIVATIVES
5-4 STATE-SPACE MODELING OF SYSTEMS
WITH INPUT DERIVATIVES
5-5 TRANSFORMATION OF MATHEMATICAL
MODELS WITH MATLAB
2
3
4
State Matrix input Matrix Output Matrix Feedback Matrix
5
6
7
8
9
10
11
12
13
14
15
5-2 TRANSIENT-RESPONSE ANALYSIS OF
SYSTEMS IN STATE-SPACE FORM WITH MATLAB

16
Example # 2

17
18
19
20
21
22
23
24
25
26
Impulse response. The unit-impulse response of a dynamic
system defined in a state space may be obtained with the use of
one of the following MATLAB commands:

sys = ss(A,B,C,D); impulse(sys), y = impulse(sys, t),


[y,t,x] = impulse(sys}, [y,t,x] = impulse(sys,t),
impulse(A,B,C, D), [y,x,t] = impulse(A,B,C,D),
[y,x,t] = impulse(A,B,C,D,iu), [y,x,t] = impulse(A,B,C,D,iu,t)

The command impulse(sys) or impulse(A,B,C,D) produces a series


of unit-impulse response plots, one for each input-output
combination of the system

27
Response to arbitrary input. The command lsim produces the
response of linear time-invariant systems to arbitrary inputs. If the
initial conditions of the system in state-space form are zero, then

lsim(sys,u,t)
produces the response of the system to an arbitrary input u with
user-specified time t. If the initial conditions are nonzero in a
state-space model, the command

Isim(sys,u,t,xo)

where Xo is the initial state, produces the response of the


system, subject to the input u and the initial condition Xo.

28
The command
[y,t] = Isim(sys,u,t,xo)

returns the output response y. No plot is drawn. To plot the


response curves, it is necessary to use the command plot(t,y).
Response to initial condition.
[y,t] = Isim(sys,u,t,xo)
Here, u is a vector consisting of zeros having length size(t).
Alternatively, if we choose B = 0 and D = 0, then u can be any
input having length size(t).
Another way to obtain the response to the initial condition given
to a system in a state-space form is to use the command

initial(A,B,C,D,xo,t)
29
Example 5-3
Consider the system shown in Figure 5-7. The system is
at rest for t < 0. At t = 0, the mass is pulled
downward by 0.1 m and is released with an initial
velocity of 0.05 m/s. That is, x(0) = 0.1 m and ẋ(0) =
0.05 m/s. The displacement x is measured from the
equilibrium position. There is no external input to
this system.

Figure 5-7 Mechanical system.

30
Example 5-3 Cont.

31
Example 5-3 Cont.

32
Example 5-3 Cont.
MATlAR Program 5-3
» t = 0:0.01 :6;
»A = *0 1; -2 -3];
» B = *0; 0];
» C = *1 0;0 1];
» D = *0; 0];
» *y, x, t+ = initial(A,B,C,D,*0.1; 0.05],t);
»y1 = [1 0+ *y’;
»y2 = [0 1+ *y’;
» plot(t,y1 ,t,y2)
» grid
» title,'Response to Initial Condition')
» xlabel{'t (sec)')
» ylabel('y_1 and y_2’)
»text(1.6,0.O5,'y_1’)
»text(1.6, -0.026,'y_2’) 33
Example 5-3 Cont.

34
5-3 STATE-SPACE MODELING OF SYSTEMS
WITH NO INPUT DERIVATIVES
Example 5-4
Consider the mechanical system shown in Figure 5-9. The system
is at rest for t < 0. At t = 0, a unit-impulse force, which is the
input to the system, is applied to the mass. The displacement x is
measured from the equilibrium position before the mass m is hit
by the unit-impulse force.

Figure 5-9 Mechanical system.


35
Example 5-4

36
Example 5-4 Cont.

37
Example 5-4 Cont.

38
Example 5-4 Cont.
» t = 0:0.01 :3;
»A = *0 1; -20 -4];
» B = *0;0.2];
» C = *1 0;0 1];
»D = *0;0];
» sys = ss(A,B,C,D);
» *y, t+ = impulse(sys,t);
»y1 = [1 0] *y';
»y2 = [0 1] *y';
» subplot(2 1 1); plot(t, y1 ); grid
» title(‘Impulse Response')
» ylabel('x')
»subplot(212); plot(t,y2); grid
» xlabel('t (sec)'); ylabel('x dot')
39
Example 5-4 Cont.

40
Example 5-5
Consider the mechanical system shown in Figure 5-11. The system is
at rest for t < 0. At t = 0, a step force f of α newtons is applied to mass
m2. [The force f = α u, where u is a step force of 1 newton.] The
displacements Z1 and Z2 are measured from the respective
equilibrium positions of the carts before f is applied. Derive a state-
space representation of the system. Assuming that m1 = 10 kg, m2 =
20 kg, b = 20 N-s/m, k1 = 30 N/m, k2 = 60 N/m, and α = 10, obtain the
response curves Z1(t) versus t, Z2(t) versus t, and Z1(t) - Z2(t) versus t
with MATLAB. Also, obtain Z1( ) and Z2( ).

41
Example 5-5 Cont.

42
Example 5-5 Cont.

43
Example 5-5 Cont.

44
Example 5-5 Cont.

45
Example 5-5 Cont.

46
Example 5-5 Cont.

Figure 5-12 Step-response curves. 47


Example 5-5 Cont.

48
Example 5-5 Cont.

and

thus

49
5-4 STATE-SPACE MODELING OF SYSTEMS
WITH INPUT DERIVATIVES

For example, consider the mechanical system shown in Figure. The


displacements y and u are measured from their respective
equilibrium positions. The equation of motion for this system is

50
51
52
53
Example 5-6
Consider the spring-mass-dashpot system mounted on a cart as shown in Figure.
Assume that the cart is standing still for t < 0. In this system, U(t) is the
displacement of the cart and is the input to the system. At t = 0, the cart is moved at
a constant speed, or ύ = constant. The displacement y of the mass is the output. (y
is measured from the rest position and is relative to the ground.) In this system, m
denotes the mass of the small cart on the large cart (assume that the large cart is
massless), b denotes the viscous-friction coefficient, and k is the spring constant.
We assume that the entire system is a linear system.
Obtain a state-space representations of the system based on methods 1 and 2 just
presented. Assuming that m = 10 kg, b = 20 N-s/m, k = 100 N/m, and the input is a
ramp function such that ύ = 1 m/s, obtain the response curve y(t) versus t with
MATLAB.

54
Example 5-6 Cont.

55
Example 5-6 Cont.

56
Example 5-6 Cont.

57
Example 5-6 Cont.

58
Example 5-6 Cont.

59
Example 5-6 Cont.

60
Example 5-6 Cont.

61
Example 5-6 Cont.

62
Example 5-6 Cont.

63
Example 5-6 Cont.

64
Example 5-6 Cont.

65
Example 5-7
Consider the front suspension system of a motorcycle. A simplified version is shown in
Figure 5-17(a). Point P is the contact point with the ground. The vertical displacement
u of point P is the input to the system. The displacements x and y are measured from
their respective equilibrium positions before the input u is given to the system.
Assume that m1 , b1 and k1 represent the front tire and shock absorber assembly and
m2, b2 and k2 represent half of the body of the vehicle. Assume also that the system is
at rest for t < 0. At t = 0, P is given a triangular bump input as shown in Figure 5-17(b).
Point P moves only in the vertical direction. Assume that m1 = 10 kg, m2 = 100 kg, b1 =
50 N-s/m, b2 = 100 N-s/m, k1 = 50 N/m, and k2 = 200 N/m. (These numerical values are
chosen to simplify the computations involved.) Obtain a state-space representation of
the system. Plot the response curve y(t) versus t with MATLAB.

66
Example 5-7 Cont.

67
Example 5-7 Cont.

68
Example 5-7 Cont.

69
Example 5-7 Cont.

70
Example 5-7 Cont.

71
Example 5-7 Cont.

72
Example 5-7 Cont.

73
Example 5-7 Cont.

74
Example 5-7 Cont.

75
Example 5-7 Cont.

76
Example 5-7 Cont.

77
5-5 TRANSFORMATION OF
MATHEMATICAL MODELS WITH MATLAB
MATLAB is quite useful in transforming a system model from transfer
function to state space and vice versa. We shall begin our discussion
with the transformation from transfer function to state space.
Let us write the transfer function Y(s)/U(s) as

78
Transformation from transfer function to state space
Consider the transfer function system

79
Transformation from transfer function to state space

80
Transformation from transfer function to state space

81
Transformation from state space to transfer function.
To obtain the transfer function from state-space equations, use the
command

82
Example 5-8

83
Example 5-8 Cont.

84
Example 5-9

85
Example 5-9 Cont.

86
Example 5-9 Cont.

87
Nonuniqueness of a set of state variables

88
Eigenvalues of an n x n matrix A.

 0 0
I   0  0 

0 0  

89
Eigenvalues of an n x n matrix A.

90
Eigenvalues of an n x n matrix A.

91
Eigenvalues of an n x n matrix A.

92
Example 5-10

93
Example 5-10 Cont.

94
Example 5-10 Cont.

95
Example 5-10 Cont.

y = Cx = C P z

96

You might also like