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.8,1,1.2,1.4,1.6,1.8,2,2.2,2.4,2.6,2.8,3]);
- # Potentialul de franare
- F = np.array([6.8,8.3,9.8,11.3,12.8,14.4,15.9,17.4,18.9,20.3,21.7,23.1]);
- # 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((0,4))
- plt.ylim((-2,40))
- txt = 'Panta: ' + str('{:.2f}'.format(P[0])) + ' μA/V'; # de scris pe grafic
- plt.text(3,10,txt);# scriu pe grafic
- txt = 'Intersectia cu ordonata: ' + str('{:.2f}'.format(P[1])); # de scris pe grafic
- plt.text(2.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(1,28,txt);# scriu pe grafic
- txt = 'ROSU'; # de scris pe grafic
- plt.text(1.85,38,txt);# scriu pe grafic
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment