Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- # definim doi vectori care contin alungirea si forta
- x = np.array([4.83,5.17,5.66,6.45]);
- # Frecventa
- F = np.array([0.11,0.33,0.4,0.75]);
- # Potentialul de franare
- 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('V0 in functie de frecventa')
- plt.xlabel('Frecventa(10^14 Hz)')
- plt.ylabel('V0(V)')
- plt.grid(True)
- plt.xlim((4,7))
- plt.ylim((0,1))
- txt = 'Panta: ' + str('{:.2f}'.format(P[0])) + '*10(-14) V/Hz'; # de scris pe grafic
- plt.text(5.75,0.2,txt);# scriu pe grafic
- txt = 'Intersectia cu ordonata: ' + str('{:.2f}'.format(P[1])); # de scris pe grafic
- plt.text(5.5,0.1,txt);# scriu pe grafic
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment