Python Forum
search of a curve fitting function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
search of a curve fitting function
#1
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
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.
Reply
#2
Which have you tried?
Reply
#3
Also, why do you think the curve is weird? What's weird about it?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Learning curve astral_travel 1 218 Mar-10-2024, 08:00 AM
Last Post: snippsat
  How can I design shapes on a curve in python? mervea 2 763 Sep-14-2023, 01:04 PM
Last Post: Pedroski55
  Fitting data to a curve daaegp 1 566 Jun-30-2023, 08:06 PM
Last Post: Gribouillis
  If function is false search next file mattbatt84 2 1,111 Sep-04-2022, 01:56 PM
Last Post: deanhystad
  Returning values from Gaussian fitting Laplace12 0 1,548 Aug-05-2021, 08:09 AM
Last Post: Laplace12
  Find factor to match test curve to golden curve SriRajesh 0 1,521 Jun-17-2021, 04:39 AM
Last Post: SriRajesh
  Fitting Gaussian curve to data file Laplace12 0 2,671 Jun-09-2021, 10:45 AM
Last Post: Laplace12
  PyAD search function adquery SpongeB0B 2 8,702 Sep-21-2020, 04:29 AM
Last Post: SpongeB0B
  Scipy kolmogorov smirnov test for evaluating the fitting of a non-normal distribution mcva 0 1,954 May-26-2020, 12:01 PM
Last Post: mcva
  Smooth curve in matplotlib medatib531 0 1,792 Apr-02-2020, 08:07 PM
Last Post: medatib531

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020