필터 지우기
필터 지우기

Kalman decomposition in symbolic value

조회 수: 6 (최근 30일)
Edoardo Moroni
Edoardo Moroni 2023년 8월 30일
편집: Voss 2023년 8월 30일
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
Dyuman Joshi
Dyuman Joshi 2023년 8월 30일
"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 2023년 8월 30일

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

댓글을 달려면 로그인하십시오.

채택된 답변

MYBLOG
MYBLOG 2023년 8월 30일
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
Edoardo Moroni
Edoardo Moroni 2023년 8월 30일
편집: Edoardo Moroni 2023년 8월 30일
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 2023년 8월 30일

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by