www.gusucode.com > control 案例程序 matlab源码代码 > control/CheckSystemControllabilityExample.m

    %% Check System Controllability
%%
% Define |A| and |B| matices.
A = [1  1;
     4 -2];
B = [1 -1;
     1 -1];

%%
% Compute controllability matrix.
Co = ctrb(A,B);

%%
% Determine the number of uncontrollable states.
unco = length(A) - rank(Co)

%%
% The uncontrollable state indicates that |Co| does not have full rank 2.
% Therefore the system is not controllable.