Problem with ctrbf() and its answer
이전 댓글 표시
Hi guys. I have this state-space system and I want to seprate the controllable and uncontrollable parts of this system hence I used ctrbf() my problem is the output doesn't define what is the Ac(Controllable part) and what is the Auc(Uncontrollable part) is..I have tried this code with the k but the problem is Ac and Bc controllablity matrix is not full rank this shows I didn't find Ac and Bc correctly.
%% Staircase controllability form by using ctrbf()
A=[-2 0 0;0 -2 0;0 0 4];
B=[0 0;0 1;1 0];
C = eye(size(A)); %Dummy C matrix :)
[A_bar, B_bar,C_bar,T,k] = ctrbf(A,B,C);
%Extract controllable and uncontrollable subspaces
nc = sum(k);
A_c = A_bar(1:nc, 1:nc); %Controllable part of A
B_c = B_bar(1:nc, :); %Controllable input
A_u = A_bar(nc+1:end, nc+1:end); %Uncontrollable part of A
disp("The controllable part of A is: ")
disp(A_c)
disp("The uncontrollable part of A is: ")
disp(A_u)
disp("The controllable B is: ")
disp(B_c)
Co_staircase = ctrb(A_c, B_c);
if rank(Co_staircase) == rank(A_c)
disp("The controllable sepration was correct")
else
disp("The controllable sepration is not correct")
end
Anyone can help me to correctly find A_c, A_u and B_c??
댓글 수: 8
Walter Roberson
2024년 12월 8일
[A_bar, B_bar,C_bar,T,k] = ctrbf(A,B,C);
%Extract controllable and uncontrollable subspaces
A_u = A_bar(1:k, 1:k); %Controllable part of A
The k that is returned is a vector that can include 0's
Each entry of k represents the number of controllable states factored out during each step of the transformation matrix calculation. The number of nonzero elements in k indicates how many iterations were necessary to calculate T, and sum(k) is the number of states in Ac, the controllable portion of Abar.
You should not be using k as the upper bounds of indexing -- it is a vector not a scalar, and it can include 0's.
naiva saeedia
2024년 12월 8일
A=[-2 0 0;0 -2 0;0 0 4];
B=[0 0;0 1;1 0];
C = eye(size(A)); %Dummy C matrix :)
[A_bar, B_bar,C_bar,T,k] = ctrbf(A,B,C);
%Extract controllable and uncontrollable subspaces
A_u = A_bar(1:sum(k), 1:sum(k)) %Uncontrollable part of A
A_c = A_bar(sum(k)+1:end, sum(k)+1:end) %Controllable part of A
B_c = B_bar(1+sum(k):end, :) %Controllable input
Paul
2024년 12월 8일
Why would you get the same result? If the number of controllable modes is nc = sum(k), then nc (not k) can be used to properly index into A_bar, B_bar, and C_bar to extract the controllable portion.
naiva saeedia
2024년 12월 8일
편집: naiva saeedia
2024년 12월 8일
Torsten
2024년 12월 8일
My answer is based on the documentation of "cbrtf". If you think the answer from "cbrtf" is incorrect, you should contact MATLAB support. I have no background knowledge in control theory to answer this.
답변 (1개)
Paul
2024년 12월 8일
0 개 추천
Check the doc page ctrbf to see how A_bar etc. are arranged in terms of the uncontrollable and controllable portions.
댓글 수: 2
naiva saeedia
2024년 12월 8일
Paul
2024년 12월 8일
Paste your current code as a comment response in this answer so we can see where things stand after all of your modifications.
카테고리
도움말 센터 및 File Exchange에서 Matrix Computations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!