2
$\begingroup$

So I have a system of non-linear differential equations that depend on a parameter $ \mu $. What I'm trying to do is take the 2-D phase portraits for different values of $ \mu $ and combine them into a 3-D plot with $\mu $ on the 3rd axis. The range of $ \mu$ that I need is $ (-2,4) $. The problem is that I have no idea how to go about it.

<span class=$ \mu =-1 $" />

<span class=$ \mu =0 $" />

<span class=$ \mu =1 $" />

Generation of phase portrait for a specific value of $\mu$

\[Mu] = 1;
eqn1 = x'[t] - y[t] + x[t] ((x[t])^2 + (y[t])^2 - \[Mu]) == 0;
eqn2 = y'[t] + x[t] + y[t] ((x[t])^2 + (y[t])^2 - \[Mu]) == 0;
eqn3 = x[0] == .01;
eqn4 = y[0] == .01;
sol = NDSolve[{eqn1, eqn2, eqn3, eqn4}, {x, y}, {t, 0, 100}];
ParametricPlot[Evaluate[{x[t], y[t]} /. sol], {t, 0, 100}, 
 PlotRange -> All, AxesLabel -> {"X", "Y"}, PlotStyle -> Red, 
 PlotLabel -> "\[Mu] = 1"]```
$\endgroup$

1 Answer 1

4
$\begingroup$

You can use ParametricNDSolveValue as follows:

ClearAll[x, y, μ, pndsv]
pndsv = ParametricNDSolveValue[{eqn1, eqn2, eqn3, eqn4},
  {x[t], y[t], μ}, {t, 0, 100}, {μ}]

enter image description here

ParametricPlot3D[Evaluate[Table[pndsv[i], {i, -2, 4, 1}]], {t, 0, 100}, 
 BoxRatios -> 1, PlotPoints -> 300, MaxRecursion -> 5, 
 PlotLegends -> LineLegend[Automatic, Range[-2, 4, 1], LegendLabel -> Style["μ", 16]]]

enter image description here

$\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.