Message Boards Message Boards

GROUPS:

[✓] Size step is effectively zero?

Posted 7 months ago
727 Views
|
1 Reply
|
2 Total Likes
|

Hello, I am trying to plot a double pendulum. But when I try to plot the results, this error occurs:

"NDSolve::ndsz: At t == 0.5517583468854775`, step size is effectively zero; singularity or stiff system suspected."

Any idea what I've got wrong?

Lagrangian = (m1 + m2)/2*l1^2*\[Theta]1'[t]^2 + 
   m2/2*l2^2*\[Theta]2[t]^2 + 
   m2*l1*l2*\[Theta]1'[t]*\[Theta]2'[t]*
    Cos[\[Theta]1[t] + \[Theta]2[t]] + (m1 + m2)*g*l1*
    Cos[\[Theta]1[t]] + m2*l2*g*Cos[\[Theta]2[t]];

g = 9.81;
l1 = 1;
l2 = 1;
m1 = 1;
m2 = 1;

eq1 = D[D[Lagrangian, \[Theta]1'[t]], t] - D[Lagrangian, \[Theta]1[t]];
eq2 = D[D[Lagrangian, \[Theta]2'[t]], t] - D[Lagrangian, \[Theta]2[t]];

sol = NDSolve[{eq1 == 0, 
    eq2 == 0, \[Theta]1[0] == Pi/10, \[Theta]1'[0] == 
     0, \[Theta]2[0] == 0, \[Theta]2'[0] == 
     0}, {\[Theta]1, \[Theta]2}, {t, 0, 10}];

Plot[{Evaluate[\[Theta]1[t] /. sol], 
  Evaluate[\[Theta]2[t] /. sol]}, {t, 0, 10}, PlotRange -> A]

Is it possible that second Lagrangian term was supposed to be m2/2*l2^2*\[Theta]2'[t]^2 (note derivative of theta_2)? With that change the integration does not go singular and the plot seems reasonable.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract