Effacer les filtres
Effacer les filtres

Kalman decomposition in symbolic value

7 vues (au cours des 30 derniers jours)
Edoardo Moroni
Edoardo Moroni le 30 Août 2023
Modifié(e) : Voss le 30 Août 2023
i need to print a kalman decomposition of a system but in symbokic values.
for example
if i write:
m1 = 1;
m2 = 2;
m3 = 3;
k0 = 100;
k1 = 100;
A = [0 0 0 1 0 0;
0 0 0 0 1 0;
0 0 0 0 0 1;
-(k0/m1) (k0/m1) 0 0 0 0;
(k0/m2) -(2*k0/m2) (k0/m2) 0 0 0;
0 (k0/m3) -(k0/m3) 0 0 0];
B = [1/m1; 0; 0; 0; 0; 0];
C = [0 1 0 0 0 0];
D = 0;
%[At,Bt,Ct,T,K]=obsvf(A,B,C)
[At,Bt,Ct,T,K]=ctrbf(A,B,C)
and it works but i need in symbolic value so i add
syms m1 m2 m3 k0 k1;
but i have an error.
how can i solve it?
or someone can send me a script contain how to use Kalman decomposition in symbolic value.
  2 commentaires
Dyuman Joshi
Dyuman Joshi le 30 Août 2023
"but i have an error."
Please copy and paste the full error message you get, i.e. all of the red text.
Also, note that the functions obsvf and ctrbf are part of the Control System Toolbox.
Do you have access to the Control System Toolbox?
Edoardo Moroni
Edoardo Moroni le 30 Août 2023

This is the error when I call syms without putting the parameters

Connectez-vous pour commenter.

Réponse acceptée

MYBLOG
MYBLOG le 30 Août 2023
Hello,
It seems like you're on the right track! To perform Kalman decomposition with symbolic values, you need to make a few adjustments to your code. Here's how you can achieve that:
% Define symbolic variables
syms m1 m2 m3 k0 k1;
% Define symbolic matrices
A = [0 0 0 1 0 0;
0 0 0 0 1 0;
0 0 0 0 0 1;
-(k0/m1) (k0/m1) 0 0 0 0;
(k0/m2) -(2*k0/m2) (k0/m2) 0 0 0;
0 (k0/m3) -(k0/m3) 0 0 0];
B = [1/m1; 0; 0; 0; 0; 0];
C = [0 1 0 0 0 0];
D = 0;
% Convert matrices to symbolic
A_sym = sym(A);
B_sym = sym(B);
C_sym = sym(C);
% Define symbolic identity matrix
I = sym(eye(size(A_sym)));
% Define the symbolic polynomial matrix for controllability
p_matrix = [B_sym A_sym*B_sym A_sym^2*B_sym A_sym^3*B_sym A_sym^4*B_sym A_sym^5*B_sym];
% Calculate the rank of the polynomial matrix
rank_original = rank(p_matrix);
% Check controllability
if rank_original == numel(A)
disp('The system is controllable.');
else
disp('The system is not fully controllable.');
end
% Define the symbolic polynomial matrix for observability
q_matrix = [C_sym; C_sym*A_sym; C_sym*A_sym^2; C_sym*A_sym^3; C_sym*A_sym^4; C_sym*A_sym^5];
% Calculate the rank of the polynomial matrix
rank_original_obs = rank(q_matrix);
% Check observability
if rank_original_obs == numel(A)
disp('The system is observable.');
else
disp('The system is not fully observable.');
end
I hope this helps you achieve your goal of printing Kalman decomposition with symbolic values. For more details, you can check out the discussion in this thread.
Best regards.
  2 commentaires
Edoardo Moroni
Edoardo Moroni le 30 Août 2023
Modifié(e) : Edoardo Moroni le 30 Août 2023
Thanks for your help put when I put your code, the system print the following matrix are this the right for a kalman decomposition because I need this to study a 3 mass non linear system ?
Edoardo Moroni
Edoardo Moroni le 30 Août 2023

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by