Modern Control Engineering

(Chris Devlin) #1
Example Problems and Solutions 841

MATLAB Program 10–29


% Response to initial condition ---- full-order observer


A = [0 1;0 -2];


B = [0;4];


C = [1 0];


K = [4 0.5];


Ke = [14;36];


AA = [A-BK BK; zeros(2,2) A-Ke*C];


sys = ss(AA, eye(4), eye(4), eye(4));


t = 0:0.01:8;


x = initial(sys, [1;0;1;0],t);


x1 = [1 0 0 0]*x';


x2 = [0 1 0 0]*x';


e1 = [0 0 1 0]*x';


e2 = [0 0 0 1]*x';


subplot(2,2,1); plot(t,x1); grid


xlabel('t (sec)'); ylabel('x1')


subplot(2,2,2); plot(t,x2); grid


xlabel('t (sec)'); ylabel('x2')


subplot(2,2,3); plot(t,e1); grid


xlabel('t (sec)'); ylabel('e1')


subplot(2,2,4); plot(t,e2); grid


xlabel('t (sec)'); ylabel('e2')


x^1 x^2

e^1 e^2

0.4

0.6

0.8

1

0.2
0
−0.2

02468

02468

02468

−0.4

0.6

0.8

1

1.2

0.4
0.2
0
−0.2

0

1

− 1

− 2

−0.5

0

− 1

−1.5

− 3

− 2

t (sec)

t (sec)

02468
t (sec)

t (sec)

Figure 10–52
Response curves to
initial condition.

Free download pdf