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 :
- Here is the picture of the curve : https://ibb.co/vZLLgHR
Thank you very much for your help
bluffy5
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 :
1 2 3 4 5 6 7 8 9 10 11 12 13 |
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() |
Thank you very much for your help
bluffy5
Larz60+ write Dec-13-2020, 02:06 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use code tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use code tags on future posts.