Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ODEfunc(t,u): return [ u[1], -0.1*u[0]-(0.2-1j*np.cos(10*t))*u[1] ];
- t = np.arange(0,30.01,0.02);
- res = solve_ivp(ODEfunc, [t[0], t[-1]], [1+0j,0j], t_eval=t)
- G = res.y[0];
- F = -res.y[1]/res.y[0];
- plt.subplot(211); plt.plot(t,G.real,t,G.imag); plt.legend(["G.real", "G.imag"]); plt.grid()
- plt.subplot(212); plt.plot(t,F.real,t,F.imag); plt.legend(["F.real", "F.imag"]); plt.ylim(-20,20); plt.grid()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement