State Space Control
Housekeeping
close all; clear; clc; s = tf('s');
DEFINITIONS & DERIVATION:
Given a system provided by the state equation and the output equation the system can be represented in state-space by the equations
and
where:
A = [0 1; 1 0];
B = [0; 1];
C = [0 1];
D = [0];
E = [0];
F = [0];
sys = ss(A,B,C,D)
CONTROLLABILITY & OBSERVABILITY
A matrix is said to be controllable if the Controllability Matrix is full range; i.e.
A matrix is said to be observable if the Observability Matrix is full range; i.e.
A matrix is said to be output-controllable if the Output Controllability Matrix is full range; i.e.
CM = ctrb(sys);
OM = obsv(sys);
OCM = [C*B C*A*B];
disp("The Controllability Matrix = "+mat2str(CM)+" and is rank "+string(rank(CM))+newline+newline...
+"The Observability Matrix = "+mat2str(OM)+" and is rank "+string(rank(OM))+newline+newline...
+"The Output Controllability Matrix = "+mat2str(OCM)+" and is rank "+string(rank(OCM)))
Transfer Function Matrix
A system in state space form can be converted to a transfer function (or a matrix of transfer functions in the case of multiple inputs or outputs) via the equation:
[num, den] = ss2tf(A,B,C,D);
sys_TF = tf(num,den)