EE443: USING MATLAB TO TEST CONTROLLABILITY AND SIMULATE STATE FEEDBACK CONTROL

Matlab m-file example7.m:
% Filename:  example7.m
%
% Description: Example using matlab to check system controllability
%              and simulate state feedback design.
%

clear; clf;
x0 = [pi/2; 0.3];                % ICs: theta=pi/2 rad, thetadot=0.3rad/sec

A = [0 1;0 0];                   % system matrices
B = [0; 0.2];
C = [1 0];

K = [205 40];                    % state feedback controller gains

Pc = ctrb(A,B);                  % construct controllability matrix
if(abs(det(Pc)) > eps)           % test for controllability
   disp('System Is Controllable');
else
   disp('System Is NOT Controllable');
end;

initial((A-B*K),[0;0],C,[0],x0); % compute and plot response
MATLAB Response Generated:
System Is Controllable
MATLAB Plot Generated: