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);

采纳的回答

Paul
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 CenterFile Exchange 中查找有关 Equation Solving 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by