MATLAB: State Space Observability and Controllability


Berikut ini adalah script MATLAB untuk menguji apakah sistem observable juga controllable.



clear all, close all, clc;

%% Define the matrices

A = [1 2;
    7 2]
% A the state matrix

B = [1; 1]
% B the input vector

C = [1 0]
% C the output vector

D = zeros(size(C,1), size(B,2))
% D the feedforward

eig(A)
% eigenvalues of A
% -2.2749
% 5.2749
% it is not stable

%% Verify the controllability and observability

Cm = ctrb(A,B)
% Controllability matrix

Om = obsv(A,C)
% Observability matrix

if rank(Cm) == size(A,1)
    'It is controllable'
else
    'It is not controllable'
end

if rank(Om) == size(A,1)
    'It is observable'
else
    'It is not observable'
end

Lihat juga tentang.
Kendali state space MATLAB.