Problems with the controllability matrix.
조회 수: 23 (최근 30일)
이전 댓글 표시
The error I get is the following:
The following error occurred converting from sym to double: Unable to convert expression containing symbolic variables into double array. Apply 'subs' function first to substitute values for variables.
Error in ctrb (line 33)
co(:,1:nu) = b;
Error in "Name_of_the_File" (line 47) Co = ctrb(A,B);
The script that I am trying to use is:
syms g L m Jx Jy Jz;
A = [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 g 0 0 0 0 0 0 0 0;
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 -g 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0;
0 0 0 0 0 0 0 -g 0 0 0 0 g/L 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1;
0 0 0 0 0 0 g 0 0 0 0 0 0 0 g/L 0];
B = [0 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 0;
-1/m 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 0;
0 1/Jx 0 0;
0 0 1/Jy 0;
0 0 0 1/Jz;
0 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 0];
Co = ctrb(A,B);
R = rank(Co);
댓글 수: 0
채택된 답변
Paul
2021년 3월 30일
ctrb() in the Control System Toolbox only accepts numeric inputs. If you have numeric values for the variables, you can substitute them into A and B and the call ctrb with the resulting numeric matrices. If you can only do it symbolically, you'll have to form the contollability matrix yourself. However, it appears that using rank() on symbolic matrices can be tricky depending on the matrix and if you really want the rank or if you just want to know if the matrix is less than full rank. Check the doc page.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Equation Solving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!