0
$\begingroup$

So I used NDsolve to find the approximation for y1 and y2, shown below.

a = 1;
b = -1; 
delta = 0.22;
f = 0.3;
eqs = { y1'[t] == y2[t], 
  y2'[t] == -b*y1[t] - delta*y2[t] - a*y1[t]^3 + f*Cos[y3[t]], 
  y3'[t] == 1, 
  y1[0] == 1, y2[0] == 0, y3[0] == 0 }
sol = NDSolve[eqs, {y1[t], y2[t]}, {t, 0, 200} ]

I'm now trying to plot y2 vs y1 but it doesn't work. Please help.

ParametricPlot[ {y2[t] /. sol, y1[t] /. sol}, {t, 0, 200} ]
$\endgroup$

closed as off-topic by Michael E2, Chris K, m_goldberg, Sektor, LCarvalho Dec 7 '17 at 8:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Michael E2, Chris K, m_goldberg, Sektor, LCarvalho
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Chris K Dec 6 '17 at 1:40
  • $\begingroup$ See the third example under "Basic Examples" of the docs for NDSolve. $\endgroup$ – Michael E2 Dec 6 '17 at 4:04
2
$\begingroup$

Try

ParametricPlot[{y2[t] /. sol[[1]], y1[t] /. sol[[1]]}, {t, 0, 200}]

enter image description here

$\endgroup$
  • $\begingroup$ Or ParametricPlot[{y2[t], y1[t]} /. sol[[1]], {t, 0, 200}] $\endgroup$ – Chris K Dec 6 '17 at 1:21
0
$\begingroup$

Alternative:

sol = NDSolveValue[eqs, {y2, y1}, {t, 0, 200}]; 
ListLinePlot[Transpose@Through[sol["ValuesOnGrid"]], AspectRatio -> Automatic]

Mathematica graphics

$\endgroup$

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