How to export symbolic matrix from MATLAB to Simulink
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a problem with a simulation: I need to create the matrices describing the problem from a set of parameters, this calculation can be done only once before starting and is done in symbolic form (need to compute jacobians). I then get some matrices with very big terms like this one (single element of an 11x11 matrix)
"q2d*((9*cos(q1)*cos(q2)*cos(q6)*(cos(q1)*cos(q6) - sin(q1)*sin(q2)*sin(q6)))/160 + (cos(q1)*cos(q2)*cos(q6)*((9*cos(q1)*cos(q6))/40 - (9*sin(q1)*sin(q2)*sin(q6))/40))/4 - (3*cos(q1)*cos(q2)*sin(q6)*(cos(q1)*sin(q6) + cos(q6)*sin(q1)*sin(q2)))/160 + (9*cos(q2)*cos(q6)*sin(q1)*(cos(q6)*sin(q1) + cos(q1)*sin(q2)*sin(q6)))/160 - (cos(q1)*cos(q2)*sin(q6)*((3*cos(q1)*sin(q6))/40 + (3*cos(q6)*sin(q1)*sin(q2))/40))/4 + (cos(q2)*cos(q6)*sin(q1)*((9*cos(q6)*sin(q1))/40 + (9*cos(q1)*sin(q2)*sin(q6))/40))/4 - (3*cos(q2)*sin(q1)*sin(q6)*(sin(q1)*sin(q6) - cos(q1)*cos(q6)*sin(q2)))/160 - (cos(q2)*sin(q1)*sin(q6)*((3*sin(q1)*sin(q6))/40 - (3*cos(q1)*cos(q6)*sin(q2))/40))/4) - q1d*(((cos(q1)*sin(q6) + cos(q6)*sin(q1)*sin(q2))*((3*cos(q1)*cos(q6))/40 - (3*sin(q1)*sin(q2)*sin(q6))/40))/4 + ((cos(q6)*sin(q1) + cos(q1)*sin(q2)*sin(q6))*((3*sin(q1)*sin(q6))/40 - (3*cos(q1)*cos(q6)*sin(q2))/40))/4 + ((cos(q1)*cos(q6) - sin(q1)*sin(q2)*sin(q6))*((3*cos(q1)*sin(q6))/40 + (3*cos(q6)*sin(q1)*sin(q2))/40))/4 + ((sin(q1)*sin(q6) - cos(q1)*cos(q6)*sin(q2))*((3*cos(q6)*sin(q1))/40 + (3*cos(q1)*sin(q2)*sin(q6))/40))/4 + ((cos(q1)*sin(q6) + cos(q6)*sin(q1)*sin(q2))*((9*cos(q1)*cos(q6))/40 - (9*sin(q1)*sin(q2)*sin(q6))/40))/4 + ((cos(q6)*sin(q1) + cos(q1)*sin(q2)*sin(q6))*((9*sin(q1)*sin(q6))/40 - (9*cos(q1)*cos(q6)*sin(q2))/40))/4 + ((cos(q1)*cos(q6) - sin(q1)*sin(q2)*sin(q6))*((9*cos(q1)*sin(q6))/40 + (9*cos(q6)*sin(q1)*sin(q2))/40))/4 + ((sin(q1)*sin(q6) - cos(q1)*cos(q6)*sin(q2))*((9*cos(q6)*sin(q1))/40 + (9*cos(q1)*sin(q2)*sin(q6))/40))/4)"
I would like to somehow "print" the matrix so that i can then use it in the real-time calculation, if i try to do it in the command window i get "... Output truncated. Text exceeds maximum line length for Command Window display.", trying to open it from the workspace i cannot get the values inside, is there any way to import - even manually - the generated syms matrices into simulink? I have no need to keep them symbolic, just need the functions written inside them.
0 Commenti
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!