I haven't got Matlab, nor have I found a suitable online tool. Could someone plot the phase diagram for the following, or point me in the right direction?

$$\frac{dx}{dt} = y - x, \frac{dy}{dt} = x(4 - y)$$


closed as off-topic by Grigory M, apnorton, Tom Oldfield, Norbert, user61527 Jun 5 '14 at 22:50

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

  • "This question is not about mathematics, within the scope defined in the help center." – Tom Oldfield, Community
  • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Grigory M, apnorton, Norbert
If this question can be reworded to fit the rules in the help center, please edit the question.


You could use WolframAlpha:

stream plot (y-x,x(4-y)), x=-1..5, y=-1..5

enter image description here

It's always nice to verify this sort of thing with analytic tools. The equilibria satisfy

\begin{align} y-x &= 0 \\ x(4-y) &= 0 \end{align}

From the second equation, $x=0$ or $y=4$. From the first equation, $x=y$. Thus, there are two equilibria at the points $(0,0)$ and $(4,4)$. The nature of the equilibria can be determined from the eigenvalues of the matrix $$ \left( \begin{array}{cc} -1 & 1 \\ 4-y & -x \end{array} \right) $$ The rows are the partial derivatives with respect to $x$ and $y$ of the system. At $x=y=4$, the eigenvalues are $-4$ and $-1$ and at $x=y=0$, there is one positive eigenvalue and one negative eigenvalue. This is consistent with the picture.

  • 1
    $\begingroup$ Is your Jacobian matrix correct? Surely it should be 4 - y in the bottom left entry? $\endgroup$ – Brian Jun 5 '14 at 21:18
  • 1
    $\begingroup$ @Brian Surely.. $\endgroup$ – Mark McClure Jun 5 '14 at 21:24
  • 1
    $\begingroup$ . . . Partially differentiate x(4-y) with respect to x? $\endgroup$ – Brian Jun 5 '14 at 21:26
  • 1
    $\begingroup$ @Brian I agreed with you once already! :) $\endgroup$ – Mark McClure Jun 5 '14 at 21:29
  • 1
    $\begingroup$ I thought the .. were sarcastic, my bad. $\endgroup$ – Brian Jun 5 '14 at 21:30

You can use octave instead (this is a free and open clone of matlab). You can assess your ODE system by a vector function such as:

function dx = f(x,t)
   dx(1) = x(2) - x(1);
   dx(2) = x(1)*(4-x(2));

Then you can solve it using lsode method for a given set of initial condition on a defined time range:

xs = lsode(@f,[1,2],0:0.01:10);

You can also plot the vector field associated with the system using quiver function. Printing xs over it give you the trajectory for the initial conditions you have chosen. By plotting several trajectories you will get a preciser idea of phase diagram associated with.

The following plots have been produced with octave using the above procedure:

Solutions Phase Diagram


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