I want to obtain a phase portrait for a system of ODEs in both 2-D and 3-D.
The code that I have currently for a 2-D system of the form x'=Ax is this:
from scipy.integrate import odeint
import numpy as np
import matplotlib.pyplot as plt
A=np.array([[1.0,2.0],[0.0,3.0]])
def model(x,t):
dxdt= -A.dot(x)
return dxdt
x0 = np.array([5.0,10.0])
t = np.linspace(0,10, 200)
x = odeint(model,x0,t)
# plot results
plt.plot(t,x)
plt.xlabel('time')
plt.ylabel('y(t)')
plt.show()
The plots I get here are the solutions against time. How can I get a phase portrait of the solution so I can observe the trajectory of the solution for each initial condition.