0
$\begingroup$

This question already has an answer here:

I have tried to plot the basin of attraction of the system \begin{eqnarray} &&\frac{dx}{dt}={y},\\[3mm] &&\frac{dy}{dt}=0.01\cos(0.54t)-1.875x^3-0.02y. \end{eqnarray} Is there anybody who can help me with this problem?

$\endgroup$

marked as duplicate by corey979, C. E., zhk, xzczd, bbgodfrey Mar 16 '17 at 20:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2
$\begingroup$

BTW, Almost exactly, the same question has been answered very elegantly by @xzczd.

Here is a starting point for you.

sol[x0_?NumericQ, y0_?NumericQ] := First@NDSolve[{x'[t] == y[t],
                y'[t] == 0.01*Cos[0.54*t] - 1.875*x[t]^3 - 0.02*y[t], x[0] == x0,
             y[0] == y0}, {x, y}, {t, 0, 10}];

ParametricPlot[ Evaluate[{x[t], y[t]} /. sol[#, #] & /@ Range[-1, 1, 0.1]], {t, 0, 
  10}, PlotRange -> All, PlotPoints -> 500, MaxRecursion -> 5, AxesLabel -> {"x", "y"}]

enter image description here

$\endgroup$
2
$\begingroup$

This is a problem custom-made for ParametricNDSolveValue, which allows us to simplify @Maple SE's fine answer further.

ClearAll[duffing, solve, x, y, t];

duffing =
 {x'[t] == y[t],
  y'[t] == 0.01*Cos[0.54*t] - 1.875 x[t]^3 - 0.02*y[t]};

solve = ParametricNDSolveValue[{duffing, x[0] == x0, y[0] == y0},
  {x[t], y[t]}, {t, 0, 10}, {x0, y0}];

ParametricPlot[
 solve[#, #] & /@ Range[-1, 1, 0.1] // Evaluate, {t, 0, 10},
 AxesLabel -> {HoldForm[x[t]], HoldForm[y[t]]}]

enter image description here

$\endgroup$

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