Advertisement
ImperfectionistCoder

Exam python courbes

Jul 16th, 2021
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. suptitle('circuit RLC, tension bobine')
  2. #Odeint
  3. X = linspace(t0,T,N)
  4. Z0 = array((ul0,ulp0))
  5. Y = odeint(f,Z0,X)
  6. Ul=[e[0] for e in Y]
  7. Ulp=[e[1] for e in Y]
  8. subplot(2,2,1)
  9. plot(X,Ul,label="UL")
  10. plot(X,Ulp,label="UL'")
  11. xlabel("temps(s)")
  12. ylabel("tension(mV)")
  13. title("Odeint")
  14. legend()
  15.  
  16. #Euler
  17. Y = euler(f,t0,T,Z0,N)
  18. Ul=[e[0] for e in Y]
  19. Ulp=[e[1] for e in Y]
  20. subplot(2,2,2)
  21. plot(X,Ul,label="UL")
  22. plot(X,Ulp,label="UL'")
  23. xlabel("temps(s)")
  24. ylabel("tension(mV)")
  25. title("Euler")
  26. legend()
  27.  
  28. #Heun
  29. Y = heun(f,t0,T,Z0,N)
  30. Ul=[e[0] for e in Y]
  31. Ulp=[e[1] for e in Y]
  32. subplot(2,2,3)
  33. plot(X,Ul,label="UL")
  34. plot(X,Ulp,label="UL'")
  35. xlabel("temps(s)")
  36. ylabel("tension(mV)")
  37. title("Heun")
  38. legend()
  39.  
  40. tight_layout() # pour ajouter l'espace entre les figures
  41.  
  42. show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement