0
$\begingroup$

I am attempting to graph trajectories for the system of equations (with independent variable t) given by

x'=5x-3y-2

y'=4x-3y-1

in the phase plane. For some reason, I can only graph trajectories for half of the points in the window range. My code is below. Try dragging the locator anywhere in the upper left to see that no solutions appear. Seems to have something to do with the flow of the trajectories.

Manipulate[
 sol = First@
   NDSolve[{x'[t] == 5 x[t] - 3 y[t] - 2, 
     y'[t] == 4 x[t] - 3 y[t] - 1, x[0] == p[[1]], 
     y[0] == p[[2]]}, {x, y}, {t, -20, 50}];
 ParametricPlot[{x[t], y[t]} /. sol, {t, -20, 20}, 
  AxesLabel -> {"x", "y"}, PerformanceGoal -> "Quality", 
  PlotRange -> 5], {{p, {1, 1}}, Locator}]

I hope to be able to graph all solutions with the locator. Some of those missing solutions are shown in the picture below. I'm pretty new to the NDSolve function, so it may be something simple I am overlooking. Any ideas?

The StreamPlot function is not suitable for my needs. So, I'm looking for a solution using NDSolve with ParametricPlot.

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Your t range is so large that the functions x and y result in hugh numbers (e.g. 10^30) are generated. If you reduce the t range e.g. to -1 to 1 everything works. $\endgroup$ Commented Mar 20, 2023 at 9:30

1 Answer 1

3
$\begingroup$

Replace {t, -20, 20} with {t, -20, 10},but I don't know the reason.

Manipulate[Module[{sol},
  sol = First@
    NDSolve[{x'[t] == 5 x[t] - 3 y[t] - 2, 
      y'[t] == 4 x[t] - 3 y[t] - 1, {x[0], y[0]} == p}, {x, 
      y}, {t, -20, 50}];
  ParametricPlot[{x[t], y[t]} /. sol, {t, -20, 10}, 
   AxesLabel -> {"x", "y"}, PerformanceGoal -> "Quality", 
   PlotRange -> 5]], {{p, {1, 1}}, Locator}]

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.