don't get what solve should return as solution
Mostrar comentarios más antiguos
Hi! I am new to symbolical equations in MATLAB. I have written the dynamics of a mobile inverted pendulum. The solution of the problem should be in this form: [ x y theta 0 0 0 0] but I get strange values. I have 3 solution per variable...I have attached the problem's parameters if someone were so nice to try the code.
%% Rappresentazione ISU
syms x y theta alpha dalpha v dtheta real
stato=[x y theta alpha dalpha v dtheta]';
syms dx dy dtheta dalpha ddalpha dv ddtheta real
d_stato=[dx dy dtheta dalpha ddalpha dv ddtheta]';
syms tau_r tau_l real
u=[tau_r tau_l]';
f1=v*cos(theta);
f2=v*sin(theta);
f3=dtheta;
f4=dalpha;
f5=(sin(2*alpha)*(b3*b1*(dtheta)^2-b5^2*(dalpha)^2)+(2*b5*b3*g*sin(alpha)))/(2*(b2*b3-b5^2*(cos(alpha)^2)));
f6=(sin(2*alpha)*(-b1*b5*(dtheta)^2*cos(alpha)-b5^2*g)+(2*b2*b5*(dalpha)^2*sin(alpha)))/(2*(b2*b3-b5^2*(cos(alpha)^2)));
f7=(-b1*dalpha*dtheta*sin(2*alpha))/(b4+b1*sin(alpha)^2);
f=[f1 f2 f3 f4 f5 f6 f7]';
T1=b2*b3-b5^2*(cos(alpha))^2;
T2=b4+b1*(sin(alpha))^2;
g5=b3*R+b5*cos(alpha);
g6=b2+(R*b5*cos(alpha));
g1=[0 0 0 0 -g5/(R*T1) g6/(R*T1) b/(R*T2)]';
g2=[0 0 0 0 -g5/(R*T1) g6/(R*T1) -b/(R*T2)]';
g=[g1 g2];
d_stato=f+g*u;
%% Risoluzione
assume(alpha<pi/2 & alpha>-pi/2)
eqns = [d_stato(1)==0 , d_stato(2)==0, d_stato(3)==0, d_stato(4)==0, d_stato(5)==0, d_stato(6)==0, d_stato(7)==0];
S= solve(eqns,[stato; tau_r; tau_l]','ReturnConditions',true);
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


