Example Problems and Solutions 841MATLAB 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^2e^1 e^20.40.60.810.2
0
−0.2024680246802468−0.40.60.811.20.4
0.2
0
−0.201− 1− 2−0.50− 1−1.5− 3− 2t (sec)t (sec)02468
t (sec)t (sec)Figure 10–52
Response curves to
initial condition.