Florii11

V0 in functie de frecventa

Dec 16th, 2020 (edited)
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3.  
  4.  
  5. # definim doi vectori care contin alungirea si forta
  6.  
  7. x = np.array([4.83,5.17,5.66,6.45]);  
  8. # Frecventa
  9.  
  10. F = np.array([0.11,0.33,0.4,0.75]);
  11. # Potentialul de franare
  12.  
  13. P = np.polyfit(x,F,1);
  14. # fiteaza (aproximeaza) datele cu un polinom de gradul 1
  15.  
  16.  
  17. Ffit = P[0]*x + P[1];
  18. # P[0] este panta iar P[1] este interesectia cu ordonata
  19.  
  20. plt.plot(x, F,'o', x ,Ffit,'-')
  21. # reprezinta datele experimetale si dreapta fitata
  22.          
  23. plt.title('V0 in functie de frecventa')
  24. plt.xlabel('Frecventa(10^14 Hz)')
  25. plt.ylabel('V0(V)')
  26.  
  27. plt.grid(True)
  28.  
  29. plt.xlim((4,7))
  30. plt.ylim((0,1))
  31.  
  32.  
  33. txt = 'Panta: ' + str('{:.2f}'.format(P[0])) + '*10(-14) V/Hz'; # de scris pe grafic
  34. plt.text(5.75,0.2,txt);# scriu pe grafic
  35.  
  36. txt = 'Intersectia cu ordonata: ' + str('{:.2f}'.format(P[1])); # de scris pe grafic
  37. plt.text(5.5,0.1,txt);# scriu pe grafic
  38.  
  39.  
  40. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment