[Math] Plot phase plane for system of differential equations

MATLABordinary differential equationssystems of equations

I'm in need of some help with matlab code. I'm working on a problem which gives the following system:

$$x'=x^2 – x – y$$

$$y'=x-y$$

We are asked to solve the system numerically starting with $(x(0), y(0))=(-0.3,-0.3)$ for $t \in [0,10]$. Additionally, we are asked to plot the solution in a phase plane and also as a function of time.

My initial reaction is to try and use the ode45 function, then plot the $x$ and $y$ components as functions of time. The thing that I'm really having trouble with is plotting the phase plane…

Any help/links/advice is greatly appreciated!

Best Answer

The phase portrait of a system of two first-order ODEs can be obtained in a similar manner as described in this post, e.g. using Matlab's quiver function. Otherwise, one can plot several trajectories $(x (t), y (t))$ obtained by numerical integration (here with ode45) and having different initial conditions.