1
$\begingroup$

I want to plot

1) vector field on a circle for the nonlinear equation and

2) theta dot and theta for different values of mu for the equation

\!\(\*OverscriptBox[\(θ\), \(.\)]\) == μSin[θ] - 
  Sin[2 θ]

I'm not getting any idea, I tried with the code as below:

Clear [θ];
eqn=Overscript[θ, .]==μSin[θ]-Sin[2θ]
sol=θ/.DSolve[{eqn,θ[0]==0},θ,t][[1,1]];
ParametricPlot[Evaluate[Table[Limit[{sol[t],D[sol[t],t]},μ->i],{i,{-3,-2,-1,0,1,2,3}}]],{t,0,100},AspectRatio->1,PlotRange->{{-5,5},{0,50}},PlotPoints->1000]
tTicks=Range[-24,24 30,24];
tGrid=Range[-60,24 30,6];
[Frame->True,FrameTicks->{tTicks,Automatic},FrameTicksStyle->Directive[Red,Thick],GridLines->{tGrid,Automatic},GridLinesStyle->LightGray,FrameLabel->(Style[#,14,Bold]&/@{θ,Overscript[θ,"."]}),AspectRatio->1]

Sincerely,

$\endgroup$

1 Answer 1

3
$\begingroup$

This is really just for fun. For simplicity $\theta$ has been changed to $u$ and $\mu$ changed to $m$ and the initial condition changed to $u(0)=1$:

{p1, p2} = {u, u'} /. 
  ParametricNDSolve[{u'[t] == m Sin[u[t]] - Sin[2 u[t]], 
    u[0] == 1}, {u, u'}, {t, 0, 4 Pi}, {m}]
Manipulate[
 Row[{
   Show[ParametricPlot[{p1[m][t], p2[m][t]}, {t, 0, 4 Pi}, 
     Epilog -> {Red, PointSize[0.02], 
       Point[{p1[m][time], p2[m][time]}]}, Frame -> True, 
     PlotRange -> Table[{-3, 3}, {2}]], 
    Plot[m Sin[v] - Sin[2 v], {v, 0, 2 Pi}, PlotStyle -> Dashed], 
    ImageSize -> 300, FrameLabel -> {"\[Theta]", "\[Theta]'"}, 
    BaseStyle -> 20], 
   Plot[p1[m][t], {t, 0, 2 Pi}, 
    Epilog -> {Red, PointSize[0.02], Point[{time, p1[m][time]}]}, 
    Frame -> True, FrameLabel -> {"t", "\[Theta](t)"}, 
    ImageSize -> 300, BaseStyle -> 20]

   }], {m, -2, 2, Appearance -> "Labeled"}, {time, 0, 4 Pi, Animator}]

enter image description here

The (hopefully) instructive points:

  • need for numerical approach NDSolve and related
  • use of ParametricNDSolve to explore variation of parameter m ($\mu$)
  • superimposition of phase space relation and solution
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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