clear all; close all;
set(0, 'DefaultAxesLineWidth', 1);
set(0, 'DefaultLineLineWidth', 2);
set(0, 'defaultAxesFontSize', 12);
A = [0 1;-6 -5];
b = [0;1];
c = [1 0];
d = 0;
op = [-5;-6];
h = acker(A',c',op)'
Ah = A - h*c;
disp('A-hcの固有値');
eig(A - h * c)
fbp = [-5; -6];
disp('求めるフィードバックゲイン');
f = acker(A,b,fbp)
Af = A - b * f
disp('閉ループ極')
eig(A - b * f)
cp = eye(2);
dp = [0;0];
sys_s_fbk = ss(Af, b, cp, dp);
AE = [Af -b*f;zeros(2) Ah];
bE = [0;0;0;1];
cE = eye(4);
dE = [0;0;0;0];
e_sys = ss(AE, bE, cE, dE);
t = 0:0.01:5;
x0 = [1;1];
x0_ob = [0;0];
y = initial(sys_s_fbk,x0,t);
ye = initial(e_sys,[x0;x0_ob-x0],t);
h_x_1 = ye(:,3) + ye(:,1);
h_x_2 = ye(:,4) + ye(:,2);
figure(1)
plot(t,ye(:,1),t,ye(:,2),t,y(:,1),t,y(:,2));
xlim([0 5]);
ylim([-2.0 1.5]);
grid;
xlabel('time t[s]');
ylabel('state');
legend('x_1(t)','x_2(t)','x_sf1(t)','x_sf2(t)');
figure(2)
plot(t,ye(:,1),t,ye(:,2),t,h_x_1,t,h_x_2);
xlim([0 5]);
ylim([-2.0 3]);
grid;
xlabel('time t[s]');
ylabel('state');
legend('x_1(t)','x_2(t)','hat{x}_1(t)','hat{x}_2(t)');
h =
6
-6
A-hcの固有値
ans =
-6
-5
求めるフィードバックゲイン
f =
24 6
Af =
0 1
-30 -11
閉ループ極
ans =
-5.0000
-6.0000