Problems with the controllability matrix.
23 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Edoardo Panichi
am 30 Mär. 2021
Kommentiert: Edoardo Panichi
am 30 Mär. 2021
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 Kommentare
Akzeptierte Antwort
Paul
am 30 Mär. 2021
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Equation Solving finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!