Skip to main content
15-Moonstone
August 8, 2016
Question

Phase Plane plot for ODE's

  • August 8, 2016
  • 2 replies
  • 4102 views

I am solving a system of ODE's. Solutions look good (I am checking against plots in a book) except when I plot two of the output functions against each other to get a phase plane plot. Changing range of axes does not seem to help. Range of axes does not correspond to range for the individual functions. What am I missing?

2 replies

12-Amethyst
August 9, 2016

Hi Jhon.

Plot over a range variable like tt := 0,0.1..1000.

For better accurate results, can check the help and the quicksheet about the function statespace(init, t1, t2, intvls, A, [B], [u])

Best regards.

Alvaro.

12-Amethyst
August 9, 2016

Hi.

In the attached, the implementation for call Rkadapt, and some few comments.

Best regards.

Alvaro.

15-Moonstone
August 9, 2016

Thanks Alvaro.

As far as I could tell, statespace only works for linear equations. But just plotting points for a range variable over a narrower range of time worked pretty well.

I had a few, probably elementary, questions on your worksheet. I have only used the symbolic manipulator in the simplest of cases. How did you actually enter you expression for the substitution; specifically the multiple line part? I could not see how to do it on my own.

Why did you use Rkadapt directly instead of Odesolve? I used to use the direct calls to the ode solvers but once I learned Odesolve, it seemed easier.

Thanks again.

John

19-Tanzanite
August 9, 2016

The quickplot function is not very reliable. It's better to define a range variable for the independent variable. Note that odesolve calculates the solution at a number of points determined by the fourth argument to the function. To find intermediate values it then interpolates using lspline. This is important, because spline interpolation does not work well for functions that are not smooth, and is even worse for discontinuous functions, as you have. You should therefore match the number of solution points to the number of points in the plot. If you try to plot more points than you solved for what you see are non-valid interpolated points (change the range variable to 0,0.01..1000 to see what I mean).

15-Moonstone
August 9, 2016

Thanks. That made the plot look much better.