The state space system
The state equation
*It is a dynamic equation expressing the first order
derivate of each state variable in terms of the state
variables and inputs.
*Its solution for input u(t) ; t>to for specified initial
state x(to) , gives the time behavior of the state
variables from which the internal behavior of the
system can be studied. It is expressed as, Time
………. (1)
Input
*The order of the system is specified by the source
minimum number of state variables needed
in the state equation. State variable
The output equation
*It is a static equation relating each output to the
state variables and inputs. It is expressed as,
………. (2)
*If t is not explicitly involved in Eqn.(1) and (2),
these describe a general time-invariant system as,
State eqn.
………. (3)
Output eqn.
*The model of a linear time-invariant system is the special
case of general time-invariant model of eqns.(3).
*The derivative of each state variable becomes a linear
combination of the system states and inputs. That is,
*where the coefficients aij and bij are constants.
*In vector-matrix form, the above eqns. can be written as,
………. (4)
*Similarly each output is a linear combination of system
states and inputs.
*For general linear time-invariant case, we may write the
output equation as,
Where the coefficients cij and dij are constants.
*In vector-matrix form, the above eqns. can be written as,
………. (5)
*Eqns. (4) and (5) may be written in compact notation as,
Where x n-dimensional state vector
u m-dimensional input vector
y p-dimensional output vector
A nxn square matrix
B nxm matrix
C pxn matrix
D pxm matrix
*In linear time-varying system the elements of the matrices
A, B, C and D are functions of time t.
Example
Consider the mechanical system shown below:
The force balance equation may be written as,
*Let us define the state variables as the
displacement and velocity y and respectively.
*The resulting state equations are:
n=2
m=1
P=1
A spring damper system
problem to be solved using
SIMULINK
By letting x=x1 and x’=x2
The equation of motion transforms into two first order equations,
x1’=x2
x2’=-(C/m) x2-(k/m) x1
With x1(0)=1 and x2(0)=0.
Multiplxer
Scope
With X2(0)=0 With X1(0)=1 (Mux)
x and x’
With C/m=20s-1
For plotting
and printing
With k/m=200s-2
The problem block diagram with plotting and printing To File
x
.x
The output signals x and dx/dt displayed versus time t on the scope
x
x’
The output signals x and dx/dt displayed versus time t on the scope
These are the contents of the
Sink Block Parameters: To File
File name: odif2_graph
Variable name: x1x2
x
% Program odif2_plot.m
load('odif2_graph')
x’
plot(x1x2)
xlabel('t');
ylabel('x and xd');
grid on
These are the contents of the
Sink Block Parameters: To File
File name: odif2_graph
Variable name: x1x2
x
% Program odif2_print.m
clc
load('odif2_graph')
fprintf(' t x xd\n\n')
B=x1x2';
x’ t=B(:,1) ; x2=B(:,2) ; x1=B(:,3) ;
n=length(t);
for i=1:n
fprintf('%10.4f%10.4f%10.4f\n',t(i),x1(i),x2(i))
end
plot(t,x1,'g',t,x2,'b')
xlabel('t'); ylabel('x and xd');
grid on
t x xd
0.0000 1.0000 0.0000
0.0250 0.9479 -3.8542
0.0500 0.8243 -5.8214
0.0750 0.6692 -6.4514
0.1000 0.5100 -6.2080
0.1250
0.1500
0.3638
0.2397
-5.4575
-4.4720 % Program odif2_print.m
0.1750
0.2000
0.1410
0.0674
-3.4392
-2.4780 clc
0.2250
0.2500
0.0161
-0.0166
-1.6536
-0.9923 load('odif2_graph')
0.2750
0.3000
-0.0348
-0.0426
-0.4943
-0.1437 fprintf(' t x xd\n\n')
0.3250
0.3500
-0.0431
-0.0393
0.0831
0.2129 B=x1x2';
0.3750
0.4000
-0.0331
-0.0262
0.2711
0.2801 t=B(:,1) ; x2=B(:,2) ; x1=B(:,3) ;
0.4250
0.4500
-0.0194
-0.0134
0.2584
0.2201 n=length(t);
0.4750
0.5000
-0.0085
-0.0046
0.1755
0.1314 for i=1:n
0.5250 -0.0019 0.0918
0.5500 -0.0000 0.0589
0.5750
0.6000
0.0011
0.0017
0.0331
0.0143 fprintf('%10.4f%10.4f%10.4f\n',t(i),x1
0.6250
0.6500
0.0019
0.0018
0.0015
-0.0065 (i),x2(i))
0.6750
0.7000
0.0016
0.0013
-0.0107
-0.0122 end
0.7250
0.7500
0.0010
0.0007
-0.0119
-0.0106 plot(t,x1,'g',t,x2,'b')
0.7750
0.8000
0.0005
0.0003
-0.0088
-0.0068 xlabel('t'); ylabel('x and xd');
0.8250
0.8500
0.0001
0.0000
-0.0050
-0.0034 grid on
0.8750 -0.0000 -0.0020
0.9000 -0.0001 -0.0011
0.9250 -0.0001 -0.0004
0.9500 -0.0001 0.0001
0.9750 -0.0001 0.0004
1.0000 -0.0001 0.0005
Multiplxer
(Mux)
Source State Space Block
x and x’
x’
The problem block diagram with state space block
By letting x=x1 and x’=x2
The equations can be put in state space form as,
x1’= 0 + x2 + 0
x2’=-(200) x1 - (20)x2 + 0
With x1(0)=1 and x2(0)=0.
In matrix form we have,
x’=A x + B u
y=C x + D u
A=[0 1 ; -200 -20]
B=[0 ; 0]
C=[1 0]
D=[0]
u=0
Initial conditions
x
x’