Questions tagged [curve-fitting]

Fitting 1-D curve to data points, minimizing pre-defined error/loss function.

From wiki:

Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points.

3428 questions
1
vote
1 answer

curve fit using a custom equation from command line without using cftool

I have some data that is curve fitting nicely using custom equation from cftool. The equation is: y = aexp(-bx)+c. Is there any way to make this same equation available from the command line? For instance using fit command and exp1 gives following…
PatStarks
  • 141
  • 1
  • 5
  • 17
1
vote
1 answer

Curve_fit resulting in a flat line

I'm new to the Scipy.optimize curve_fit() tool. I'm trying to find a function that best models the curve in the figure (part of a time series signal), but meanwhile I was just fitting a sine curve to it and got a flat line. Can someone spot what I'm…
1
vote
1 answer

Wrong Voigt output/convolution with asymmetric x input

At the moment I am fitting a Gaussian or Lorentz to my data but both don't fit well enough and I want to switch to Voigt fitting, a convolution of them both. I retrieved the Voigt function from https://www.originlab.com/doc/Origin-Help/Voigt-FitFunc…
Terranees
  • 141
  • 1
  • 2
  • 12
1
vote
0 answers

Python: for loop overwrites a lambda function created in the loop

I'm working with Python 2.7 and I stumbled on this issue and I cannot even understand the logic of why the following doesn't work. I need to fit different dataset and I want to do it dynamically in a for loop. Here is a MWE that duplicates the…
DiracRules
  • 41
  • 1
  • 3
1
vote
0 answers

How to get the confidence interval for interpolation?

I perform the linear interpolation and specifies where interpolation is to take place. I get the interpolated data, but I don't know how to get the confidence interval for these interpolated data (red) by linear interpolation. Is there any other way…
Revo
  • 111
  • 8
1
vote
0 answers

How do I utilize curve_fit errors?

I am trying to understand the errors from Curve_Fit and would appreciate if somebody could look over my code and advise if I have understood the error processing correctly. My objective is to take observables, fit a polynomial then using fit…
Mike
  • 11
  • 1
1
vote
1 answer

How do I add free parameters in Curve Fitting Toolbox (Matlab)?

I have obtained a best fit for a dataset with CFT in Matlab. I now would like to try how good the fit is on another dataset. Can I do this within CFT? I was thinking of plugging in the fit equation from the first dataset with the addition of one…
magnolia1
  • 65
  • 5
1
vote
0 answers

Fitting of multiple input multiple output function with MATLAB

I have a function that can be written as following: [y1, y2] = function(x1,x2,a,b) And I have some experimental data, is there any function in MATLAB that can help me in the fitting procedure? The function is non-linear and it is defined in an…
Yuri
  • 11
  • 2
1
vote
1 answer

Matlab cftool - fit using percentage deviation as criteria

I have a strong varying data which I am trying to fit using custom function in cftool in Matlab. The issue is that the fit is done default using sum of squared errors (SSE) as criteria to minimize the fit. This results in large errors in fit for…
SKPS
  • 5,433
  • 5
  • 29
  • 63
1
vote
1 answer

How to curve fit data to a known formula with two independence variables?

Suppose I have a nonlinear formula like y = (ax + bx^2 + cx^3) * dx1^2 Where a,b,c,d are coefficients to be found and x and x1 are data in a table I am trying to fit. I need an optimization algorithm I can write in code (e.g C or Delphi) to run…
user3516612
  • 21
  • 1
  • 4
1
vote
0 answers

How to improve bad fit of scipy's curve_fit?

I have a histogram that is given as two lists, one representing the bins and the other the number of occurences. When plotting it, I get the blue bars in the picture below. For my application, I want to fit an exponential function into my data…
DocDriven
  • 3,726
  • 6
  • 24
  • 53
1
vote
2 answers

Fitting with constraints on derivative Python

While trying to create an optimization algorithm, I had to put constraints on the curve fitting of my set. Here is my problem, I have an array : Z = [10.3, 10, 10.2, ...] L = [0, 20, 40, ...] I need to find a function that fits Z with condition on…
1
vote
0 answers

Exponential curve fit with custom dataset - Output is flat line

I took some weights from coworkers, bootstrapped 1000 runs where each run samples 3 values from the original data and appends the minimum, and now I'm trying to curve fit these values to an exponential fit. When I plot the histogram, it isn't a…
Sean Mahoney
  • 131
  • 7
1
vote
1 answer

Divide by zero error in scipy.optimize.curvefit

I am trying to fit three time-evolution curves with two rate constants, k1 and k2. The system of equations I am trying to solve is: A_t = A_0 * exp(-k1*t) B_t = [A_0 * k1/(k2-k1)]* exp(-k1*t) - [A_0*(k1/(k2-k1)-B_0] * exp(-k2*t) C_t = [A_0 *…
1
vote
1 answer

Printing Curve Fit Function

I have been struggling to find a way to get the determined parameters for the curve fit function below to print. The graph properly matches my data, but I can't figure out how to get the equation it produced. Any help would be appreciated! import…
Kat
  • 21
  • 3