Skip to content

Instantly share code, notes, and snippets.

@pavelskipenes
Created October 18, 2022 12:48
Show Gist options
  • Save pavelskipenes/002b9d8953676bba29a18a90e8de2067 to your computer and use it in GitHub Desktop.
Save pavelskipenes/002b9d8953676bba29a18a90e8de2067 to your computer and use it in GitHub Desktop.
%{
octave:4> help obsv
'obsv' is a function from the file /usr/share/octave/packages/control-3.4.0/obsv.m
-- Function File: OB = obsv (SYS)
-- Function File: OB = obsv (A, C)
Return observability matrix.
*Inputs*
SYS
LTI model.
A
State matrix (n-by-n).
C
Measurement matrix (p-by-n).
*Outputs*
OB
Observability matrix.
*Equation*
| C |
| CA |
Ob = | CA^2 |
| ... |
| CA^(n-1) |
Additional help for built-in functions and operators is
available in the online version of the manual. Use the command
'doc <topic>' to search the manual index.
Help and information about Octave is also available on the WWW
at https://www.octave.org and via the [email protected]
mailing list.
%}
%x_vector = [x_1 x_2 x_3 x_4 x_5];
%x_dot_vector = [x_1_dot x_2_dot x_3_dot x_4_dot x_5_dot];
%
%u_vector = [V_s V_d];
%B_matrix = [
% 0 0 ;
% 0 K_1 ;
% 0 0 ;
% K_2 0 ;
% 0 0 ;
%];
pkg load control;
pkg load symbolic;
% syms K_3
K_3 = 1;
A_matrix = [
[0 1 0 0 0];
[0 0 0 0 0];
[0 0 0 1 0];
[0 0 0 0 0];
[K_3 0 0 0 0] ;
];
% all observability matrixcies with two observable states
C_matrixies = unique(perms([1 1 0 0 0]), "rows")
%C_matrixies = eye(5)
% for each C matrix
for i = 1:size(C_matrixies,1)
% calculate observability matrix
ob = obsv(A_matrix, C_matrixies(i, :));
disp(["rank of the observability matrix is ", num2str(rank(ob))])
end
% problem 3 angle measurement
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment