enter image description here

enter image description here

Here I am only concerned with the plotting. I am not new to Mathematica, but i have no idea how to complete part B and graph the angle or velocity or phase diagrams. Any help is appreciated.

  • 3
    $\begingroup$ If you have solved part A, please show us your work... once you have part A solved, then you can plot the parameters of interest. $\endgroup$ – bill s Nov 21 '17 at 20:44
  • $\begingroup$ Here I have added the solution to part A $\endgroup$ – Isaac Dec 7 '17 at 20:57

May be this will get you started. I used the ODE's as given in https://en.wikipedia.org/wiki/Spherical_pendulum

Mathematica graphics

solved the above coupled non-linear ODE's using NDSolve for some t interval, and made the plots

m = 0.5; r = 1; g = 9.81;
ClearAll[theta, phi, t];
ode1 = D[m r^2 theta'[t], t] - 
    m r^2 Sin[theta[t]] Cos[theta[t]] phi'[t]^2 + 
    m g r Sin[theta[t]] == 0;
ode2 = D[m r^2 Sin[theta[t]]^2 phi'[t], t] == 0;

ic = {theta[0] == 10 Degree, theta'[0] == 0, phi[0] == 0, phi'[0] == 1}; 
(*need phi'(0) not zero to get something interesting*)

{theta, phi} = {theta, phi} /. 
  First@NDSolve[{ode1, ode2, ic}, {theta, phi}, {t, 0, 10}];

Now made the plots

p1=Plot[theta[t],{t,0,10},Frame->True,FrameLabel->{{"theta(t)",None},{"time (sec)","theta vs. time"}},GridLines->Automatic,GridLinesStyle->LightGray];
p2=Plot[phi[t],{t,0,10},Frame->True,FrameLabel->{{"phi(t)",None},{"time (sec)","phi vs. time"}},GridLines->Automatic,GridLinesStyle->LightGray];
p3=Plot[theta'[t],{t,0,10},Frame->True,FrameLabel->{{"theta'(t)",None},{"time (sec)","theta' vs. time"}},GridLines->Automatic,GridLinesStyle->LightGray];
p4=Plot[phi'[t],{t,0,10},Frame->True,FrameLabel->{{"phi'(t)",None},{"time (sec)","phi' vs. time"}},GridLines->Automatic,GridLinesStyle->LightGray];


Mathematica graphics

And used ParametricPlot for phase plot


Mathematica graphics

  • $\begingroup$ For your NDSolve line of your first ODE, what did you use as your variable? I am also getting a recursionlimit error. $\endgroup$ – Isaac Dec 11 '17 at 17:18
  • $\begingroup$ @Isaac I am sorry, I do not understand the question. The code posted above works as is. no recursionlimit for me. May be you can try the code from clean kernel? may be you have some other definitions getting in the way. $\endgroup$ – Nasser Dec 11 '17 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.