Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. def my_function(x,a, c):
  2. return a/x + c
  3.  
  4. params = {
  5. 'figure.figsize': [15, 10]
  6. }
  7. plt.rcParams.update(params)
  8.  
  9.  
  10. ax = plt.subplot(111)
  11. ax.spines["top"].set_visible(False)
  12. ax.spines["right"].set_visible(False)
  13. angle, inte = sp.loadtxt("Current.csv", skiprows=10, unpack=1, delimiter=',')
  14. err_angle = 1
  15.  
  16. # Our initial guess for the parameters
  17.  
  18. guess_a=2
  19. guess_c=1
  20. p0=[guess_a, guess_c]# Array that of initial parameter values
  21.  
  22. fit = curve_fit(my_function, x, y, p0=p0)
  23. x=sp.arange(0.3,7,0.001)
  24. data_fit = my_function(x, *fit[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement