# Plot phase plane for system of differential 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...

• For the phase plane and solution curve, are you using the stuff here matlab.cheme.cmu.edu/2011/08/09/…? – Moo Jan 27 '17 at 0:17
• @Moo that was very helpful! I wasn't aware of that site, but I'm glad/thankful you sent it my way. Thank you very much--it did the trick for me. – George Oscar Bluth Jan 27 '17 at 2:27
• Glad it was of service and that you resolved your issues! Regards. – Moo Jan 27 '17 at 2:29

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.
• This does not answer the question and the question already indicates that ode45 is being used, which is superior to a generic RK4 scheme. – horchler Jan 27 '17 at 0:21