Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. def ODEfunc(t,u): return [ u[1], -0.1*u[0]-(0.2-1j*np.cos(10*t))*u[1] ];
  2. t = np.arange(0,30.01,0.02);
  3. res = solve_ivp(ODEfunc, [t[0], t[-1]], [1+0j,0j], t_eval=t)
  4.  
  5. G = res.y[0];
  6. F = -res.y[1]/res.y[0];
  7. plt.subplot(211); plt.plot(t,G.real,t,G.imag); plt.legend(["G.real", "G.imag"]); plt.grid()
  8. plt.subplot(212); plt.plot(t,F.real,t,F.imag); plt.legend(["F.real", "F.imag"]); plt.ylim(-20,20); plt.grid()
  9. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement