Message Boards Message Boards

1
|
10138 Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How to plot a phase portrait in a circle for a nonlinear DE?

Posted 9 years ago

Hi,

I want to plot

1) the phase portrait in a circle

and 2) thetadot versus theta for different values of mu.

for the differential equation \!(*OverscriptBox[([Theta]), (.)]) == [Mu]Sin[[Theta]] - Sin[2 [Theta]]

My code is not working as given below:

Clear [\[Theta]];
eqn=Overscript[\[Theta], .]==\[Mu]Sin[\[Theta]]-Sin[2\[Theta]]
sol=\[Theta]/.DSolve[{eqn,\[Theta][0]==0},\[Theta],t][[1,1]];
ParametricPlot[Evaluate[Table[Limit[{sol[t],D[sol[t],t]},\[Mu]->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]&/@{\[Theta],Overscript[\[Theta],"."]}),AspectRatio->1]

Regards,

POSTED BY: Rahul Chakrabory
5 Replies

If you have version 9 or later, you can use NDSolveValue, with an easier syntax. You get a less boring plot by plotting over larger values of t and by zooming in with PlotRange:

\[Mu] = -1;
eon = \[Theta]'[t] == \[Mu] Sin[\[Theta][t]] - Sin[2 \[Theta][t]];
sol = NDSolveValue[{eon, \[Theta][0] == 1/2}, \[Theta], {t, 0, 50}];
ParametricPlot[{sol[t], sol'[t]}, {t, 4, 50}, Frame -> True, 
 AxesLabel -> {"\[Theta]", Overscript[\[Theta], "."]}, 
 AspectRatio -> 1, PlotStyle -> Directive[Red, AbsoluteThickness[0]], 
 BaseStyle -> {FontFamily -> "Courier", FontWeight -> "Bold", 
   FontSize -> 16}, PlotRange -> 10^-9, ImageSize -> Large]
POSTED BY: Gianluca Gorni

You can avoid the use of Part by using the form NDSolve[{eqnAndICs}, dependentVar, {independenVar, start, end}].

Regarding the plot you're getting, does the following help explain anything?

 \[Mu] = -1;
 eon = \[Theta]'[t] == \[Mu] Sin[\[Theta][t]] - Sin[2 \[Theta][t]];
 sol = NDSolve[{eon, \[Theta][0] == 1/2}, \[Theta], {t, 0, 50}];

 Plot[Evaluate[{\[Theta][t] /. sol, D[\[Theta][t] /. sol, t]}], {t, 0, 10}, PlotRange -> 0.2]

enter image description here

POSTED BY: Murray Eisenberg

Dear Sir,

I'm getting some plot as below:

Clear[\[Mu],x];
\[Mu]=-1;
eon=\[Theta]'[t]==\[Mu] Sin[\[Theta][t]]-Sin[2 \[Theta][t]];//Simplify;
sol=NDSolve[{eon,\[Theta][0]==1/2},\[Theta][t],{t,0,50}][[1]]
ParametricPlot[Evaluate[{\[Theta][t]/.sol,D[\[Theta][t]/.sol,t]}],{t,0,10},Frame->True,AxesLabel->{"\[Theta]",Overscript[\[Theta],"."]},AspectRatio->1,PlotStyle->{{Red,AbsoluteThickness[0]}},BaseStyle->{FontFamily->"Courier",FontWeight->"Bold",FontSize->16}]

But its a linear plot, there should have been some nonlinearity which doesn't seem to be available.

Sir, I'm not very clear regarding the use of [[1]] or [[1,1]]. If you kindly let me know , I would be grateful.

Sincerely, Rahul

POSTED BY: Rahul Chakrabory

Have a look here for the usage of [[...]]: https://reference.wolfram.com/language/ref/Part.html

POSTED BY: Sander Huisman

To begin, you need to use:

eon = \[Theta]'[t]==\[Mu] Sin[\[Theta][t] - Sin[2 \[Theta][t] ;

The issues so far:

  • say explicitly that you're taking a derivative of theta; Mathematicadoes not have any built-in meaning for an overdotted symbol.
  • explicitly make [Theta]' and [Theta] functions of some other variable, say t.
  • leave a space between [Mu] and Sin, since otherwise you'd have a completely new variable named [Mu]Sin (a legitimate name but one that has no meaning in your problem).

With those changes to make the syntax correct, the DSolve expression

DSolve[{eqn, \[Theta][0] == 0}, \[Theta], t]

produces some warning messages that for some branches of the general solution, the given boundary conditions lead to an empty solution — and so Mathematica is unable to take the part [[1, 1]], which simply does not exist then.

Next, no value has been assigned to [Mu], so even in the absence of that trouble with empty solution, I don't see how you could possibly plot the solution, let alone its derivative.

Perhaps, once you've assigned a specific numeric value to [Mu], you might need to use NDSolve rather than DSolve.

POSTED BY: Murray Eisenberg
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