Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- 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]);
- # Potentialul de franare
- F = np.array([5.7, 7.8,10,12.4,14.8,17.2,19.7,22.24,24.8,27.3,29.8,32.4,34.9,37.5,39.9,42.4,44.8,47.3,49.7,52.2,54.8,57.4,60,62.8 ]);
- # Intensitatea
- P = np.polyfit(x,F,1);
- # fiteaza (aproximeaza) datele cu un polinom de gradul 1
- Ffit = P[0]*x + P[1];
- # P[0] este panta iar P[1] este interesectia cu ordonata
- plt.plot(x, F,'o', x ,Ffit,'-')
- # reprezinta datele experimetale si dreapta fitata
- plt.title('Intensitatea in functie de potential')
- plt.xlabel('Vac(V)')
- plt.ylabel('I(μA)')
- plt.grid(True)
- plt.xlim((-1,5))
- plt.ylim((-2,105))
- txt = 'Panta: ' + str('{:.2f}'.format(P[0])) + ' μA/V'; # de scris pe grafic
- plt.text(2,10,txt);# scriu pe grafic
- txt = 'Intersectia cu ordonata: ' + str('{:.2f}'.format(P[1])); # de scris pe grafic
- plt.text(1.3,6,txt);# scriu pe grafic
- txt = 'I(V)=' + str('{:.2f}'.format(P[0])) + 'V+' +str('{:.2f}'.format(P[1])) + ' μA'; # de scris pe grafic
- plt.text(0.2,70,txt);# scriu pe grafic
- txt = 'VERDE'; # de scris pe grafic
- plt.text(1.85,95,txt);# scriu pe grafic
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment