Florii11

albastru

Dec 16th, 2020 (edited)
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.29 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3.  
  4.  
  5. x = np.array([0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2,2.2,2.4,2.6,2.8,3,3.2,3.4,3.6,3.8,4,4.2,4.4,4.6]);  
  6. # Potentialul de franare
  7.  
  8. F = np.array([13.92, 17.65, 21.48, 25.34, 29.25, 33.11, 36.94, 40.76, 44.55, 48.35, 52.12, 55.89, 59.63, 63.32, 66.95, 70.54, 74.15, 77.78, 81.47, 85.25, 89.1, 93, 97, 101]);
  9. # Intensitatea
  10.  
  11. P = np.polyfit(x,F,1);
  12. # fiteaza (aproximeaza) datele cu un polinom de gradul 1
  13.  
  14.  
  15. Ffit = P[0]*x + P[1];
  16. # P[0] este panta iar P[1] este interesectia cu ordonata
  17.  
  18. plt.plot(x, F,'o', x ,Ffit,'-')
  19. # reprezinta datele experimetale si dreapta fitata
  20.          
  21. plt.title('Intensitatea in functie de potential')
  22. plt.xlabel('Vac(V)')
  23. plt.ylabel('I(μA)')
  24.  
  25. plt.grid(True)
  26.  
  27. plt.xlim((-1,6))
  28. plt.ylim((0,115))
  29.  
  30.  
  31. txt = 'Panta: ' + str('{:.2f}'.format(P[0])) + ' μA/V'; # de scris pe grafic
  32. plt.text(2,10,txt);# scriu pe grafic
  33.  
  34. txt = 'Intersectia cu ordonata: ' + str('{:.2f}'.format(P[1])); # de scris pe grafic
  35. plt.text(1,6,txt);# scriu pe grafic
  36.  
  37. txt = 'I(V)=' + str('{:.2f}'.format(P[0])) + 'V+' +str('{:.2f}'.format(P[1])) + ' μA'; # de scris pe grafic
  38. plt.text(-0.5,90,txt);# scriu pe grafic
  39.  
  40. txt = 'ALBASTRU'; # de scris pe grafic
  41. plt.text(2,105,txt);# scriu pe grafic
  42.  
  43.  
  44. plt.show()
Add Comment
Please, Sign In to add comment