m = 1; k = 10; c = -0.1;
A = [-c/m, -k/m; 1, 0]; % unstable plant
B = [1/m; 0];
%C = [0, 1]; % original setting but not used

Uc = ctrb(A,B);
det(Uc) % ***1st disp.*** should be nonzero, which means (A,B):controllable
C = eye(2); D = zeros(2,1); % state feedback
F = [0, 0]; % without control
x0 = [1; 1]; % initial state
Q = eye(2);
R = 1;
P = are(A, B/R*B', Q);
eig(P) % ***2nd disp.*** should be positive
F = R\B'*P;
Jmin = x0'*P*x0 % ***3rd disp*** to be compared with Simulink

mod0921_1;
