clear all; close all;
A = [0 1;-6 -5];
b = [0;1];
c = [1 0];
d = 0;
op = [-5 + 6i;-5 - 6i];
h = acker(A',c',op)'
Ah = A - h*c;
disp('A-hcの固有値');
eig(A - h * c)
cc = eye(2);
dd = [0;0];
sys = ss(A, b, cc, dd);
e_sys = ss(Ah, b, cc, dd);
t = 0:0.01:10;
x0 = [1;1];
x0_ob = [0;0];
y = initial(sys,x0,t);
e = initial(e_sys,x0_ob - x0,t);
h_x = e + y;
figure(1)
plot(t,y(:,1),t,y(:,2),t,h_x(:,1),t,h_x(:,2));
xlim([0 10]);
ylim([-1.0 3.0]);
grid;
xlabel('time t[s]');
ylabel('state');
legend('x_1(t)','x_2(t)','hat{x}_1(t)','hat{x}_2(t)');
figure(2)
plot(t,e(:,1),t,e(:,2));
xlim([0 10]);
ylim([-2.0 4.0]);
grid;
xlabel('time t[s]');
ylabel('state');
legend('e_1(t)','e_2(t)');
figure(3)
plot(t,y(:,1),t,y(:,2),t,h_x(:,1),t,h_x(:,2));
xlim([0 4]);
ylim([-1.0 3.0]);
grid;
xlabel('time t[s]');
ylabel('state');
legend('x_1(t)','x_2(t)','hat{x}_1(t)','hat{x}_2(t)');
op2 = [-4;-5];
h2 = acker(A',c',op2)'
Ah2 = A - h2*c;
disp('A-hcの固有値');
eig(A - h2 * c)
cc = eye(2);
dd = [0;0];
sys = ss(A, b, cc, dd);
e_sys2 = ss(Ah2, b, cc, dd);
e2 = initial(e_sys2,x0_ob - x0,t);
h_x2 = e2 + y;
figure(4)
plot(t,y(:,1),t,y(:,2),t,h_x2(:,1),t,h_x2(:,2));
xlim([0 4]);
ylim([-1.0 3.0]);
grid;
xlabel('time t[s]');
ylabel('state');
legend('x_1(t)','x_2(t)','hat{x}_1(t)','hat{x}_2(t)');
h =
5
30
A-hcの固有値
ans =
-5.0000 + 6.0000i
-5.0000 - 6.0000i
h2 =
4
-6
A-hcの固有値
ans =
-4
-5