Hi Jiwon,
I understand that you wish to plot the phase portrait of a nonlinear system of ODEs.
For a nonlinear system of the form:
plotting the phase portrait is a straightforward task.
In a phase portrait, we plot the trajectories of the system in the phase plane. Trajectories follow the direction field. The direction of the trajectory is the direction of the velocity vector, defined as (f(x,y), g(x,y))
You may use the “quiver” function to plot arrows with directional components at each point in the phase plane to achieve the same.
Please refer to the following code:
plot(x, zeros(size(x)), 'g--');
plot(p/r+zeros(size(y)), y, 'g--');
legend("", "X nullcline", "Y nullcline");
The code also plots X and Y nullclines of the system for comparison.
Please refer to the following MATLAB documentation for further reference:
Hope this helps!
Best regards,
Saarthak