Python Forum

Full Version: search of a curve fitting function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi,
i'm new in python and i have successfully plot a function. the problem is i need to curve fit it to have a fitted peak. The problem, i don't know which function i need to return. the exercice say use whatever function give the best result but i don't know what to use because the curve is weird.
here is my code :

  
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
data_1 = np.loadtxt(file_1).T
plt.plot(data_1[0],data_1[1])
plt.legend(('1'),loc='best', fontsize=15) #legendes , 'die 2', 'die 3', 'die 4'
plt.grid()
plt.title('dBm in function of wavelength')
plt.xlabel('wavelength (nm)')
plt.ylabel('dBm')

plt.show()
- Here is the picture of the curve : https://ibb.co/vZLLgHR
Thank you very much for your help
bluffy5
Which have you tried?
Also, why do you think the curve is weird? What's weird about it?