Solving equations for a specified variable in terms of other variables

8 visualizaciones (últimos 30 días)
I am trying to solve euqation (13) and (16) as listed on this website https://www.myphysicslab.com/pendulum/double-pendulum-en.html
This is what I have attempted so far however I am running into errors
syms g x1 y1 x2 y2 l1 l2 m1 m2 theta1 theta2 omega1 omega2 alpha1 alpha2 dy1 dy2 dx1 dx2 d2y1d d2y2 d2x1 d2x2
x1= l1*sin(theta1);
y1= -l1*cos(theta1);
x2 = x1+l2*sin(theta2);
y2 = y1-l2*cos(theta2);
dx1 = omega1*l1*cos(theta1);
dy1 = omega1*l1*sin(theta1);
dx2 = dx1 + omega2*l2*cos(theta2);
dy2 = dy1 + omega2*l2*sin(theta2);
d2x1 = -omega1^2*l1*sin(theta1)+alpha1*l1*cos(theta1);
d2y1 = omega1^2*l1*cos(theta1)+alpha1*l1*sin(theta1);
d2x2 = d2x1-omega2^2*l2*sin(theta2)+alpha2*l2*cos(theta2);
d2y2 = d2y1+omega2^2*l2*cos(theta2)+alpha2*l2*sin(theta2);
solve('sin(theta1)*(m1*d2y1+m2*d2y2+m2*g+m1*g)==-cos(theta1)*(m1*d2x1+m2*d2x2)', 'alpha1')
solve('sin(theta2)*(m2*d2y2+m2*g)==-cos(theta2)*m2*d2x2', 'alpha2')
Any help is much appreciated

Respuestas (1)

Eugenio Grabovic
Eugenio Grabovic el 30 de En. de 2019
Editada: Eugenio Grabovic el 30 de En. de 2019
syms g l1 l2 m1 m2 theta1 theta2 omega1 omega2 alpha1 alpha2
x1= l1*sin(theta1);
y1= -l1*cos(theta1);
x2 = x1+l2*sin(theta2);
y2 = y1-l2*cos(theta2);
dx1 = omega1*l1*cos(theta1);
dy1 = omega1*l1*sin(theta1);
dx2 = dx1 + omega2*l2*cos(theta2);
dy2 = dy1 + omega2*l2*sin(theta2);
d2x1 = -omega1^2*l1*sin(theta1)+alpha1*l1*cos(theta1);
d2y1 = omega1^2*l1*cos(theta1)+alpha1*l1*sin(theta1);
d2x2 = d2x1-omega2^2*l2*sin(theta2)+alpha2*l2*cos(theta2);
d2y2 = d2y1+omega2^2*l2*cos(theta2)+alpha2*l2*sin(theta2);
eq1 = sin(theta1)*(m1*d2y1+m2*d2y2+m2*g+m1*g)==-cos(theta1)*(m1*d2x1+m2*d2x2);
eq2 = sin(theta2)*(m2*d2y2+m2*g)==-cos(theta2)*m2*d2x2;
solutions = solve([eq1 eq2],[alpha1 alpha2])
If u check solver helper its written that it doesn't accept char vectors anymore and requires just symbolycs. Should be working now. In addition a system of equations requires to be solved within the same solver.
  9 comentarios
madhan ravi
madhan ravi el 30 de En. de 2019
+1 Eugenio , appreciate your effort,
you can also change your last line to:
[alpha1 alpha2] = solve([eq1 eq2],[alpha1 alpha2])
Alastair Poore
Alastair Poore el 30 de En. de 2019
It's ok. Thanks for trying, ill try figure another way out

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by