search of a curve fitting function - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: search of a curve fitting function (/thread-31453.html) |
search of a curve fitting function - bluffy5 - Dec-12-2020 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 RE: search of a curve fitting function - deanhystad - Dec-12-2020 Which have you tried? RE: search of a curve fitting function - ndc85430 - Dec-13-2020 Also, why do you think the curve is weird? What's weird about it? |