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
7
votes
1 answer

SGM Disparity subpixel estimation - how to?

Some weeks ago I've implemented a simple block matching stereo algorithm but the results had been bad. So I've searched on the Internet to find better algorithms. There I found the semi global matching (SGM), published by Heiko Hirschmueller. It…
7
votes
3 answers

How to speed up python curve_fit over a 2D array?

I have to use the curve_fit numpy function over a large set of data (5 000 000). So basically I've created a 2D array. First dimension is the number of fittings to perform, second dimension is the number of points used for the fitting. t =…
7
votes
1 answer

Rational function curve fitting in python

I am trying to fit a curve to X and Y data points using a rational function. It can be done in Matlab using the cftool (http://de.mathworks.com/help/curvefit/rational.html). However, I am looking to do the same in Python. I have tried to use…
Hassan Salman
  • 125
  • 2
  • 7
7
votes
1 answer

How to quantitatively measure goodness of fit in SciPy?

I am tying to find out the best fit for data given. What I did is I loop through various values of n and calculate the residual at each p using the formula ((y_fit - y_actual) / y_actual) x 100. Then I calculate the average of this for each n and…
Tom Kurushingal
  • 6,086
  • 20
  • 54
  • 86
7
votes
3 answers

SVG curve through predetermined points

I am a beginner in SVG. I need an SVG curve that passes through a list of points. It is a math function that is calculated in C++ and the output result is supposed to be written in an SVG file. My problem is that the path tag in SVG does not pass…
barej
  • 1,330
  • 3
  • 25
  • 56
7
votes
3 answers

Algorithm to smooth a curve while keeping the area under it constant

Consider a discrete curve defined by the points (x1,y1), (x2,y2), (x3,y3), ... ,(xn,yn) Define a constant SUM = y1+y2+y3+...+yn. Say we change the value of some k number of y points (increase or decrease) such that the total sum of these changed…
Sohaib
  • 4,556
  • 8
  • 40
  • 68
7
votes
3 answers

Exponential based Curve-Fit using Math.Net

I'm very new to the Math.Net Library and I'm having problems trying to do curve-fitting based on an exponential function. More specifically I intend to use this function: f(x) = a*exp(b*x) + c*exp(d*x) Using MATLAB I get pretty good results, as…
eol
  • 23,236
  • 5
  • 46
  • 64
7
votes
2 answers

curve fitting with integer inputs Python 3.3

I am using scipy's curvefit module to fit a function and wanted to know if there is a way to tell it the the only possible entries are integers not real numbers? Any ideas as to another way of doing this?
7
votes
1 answer

Curve fitting in R using nls

I'm trying to fit a curve over (the tail of) the following data: [1] 1 1 1 1 1 1 2 1 2 2 3 2 1 1 4 3 2 11 6 2 16 7 17 36 [25] 27 39 41 33 42 66 92 138 189 249 665 224 309 247 641 777 671 532 749…
Pieter
  • 3,339
  • 5
  • 30
  • 63
7
votes
1 answer

Difference between curve_fit and leastsq in python from scipy.optimize

I have a function containing: Independent variable X, Dependent variable Y Two fixed parameters a and b. Using identical experimental data, both the curve_fit and leastsq functions could be fitted to the function with similar results. Using…
user3208105
  • 71
  • 1
  • 4
7
votes
2 answers

Is there a GNU Octave equivalent for the Matlab function "fit"?

My teacher in the signal analysis course has given me some Matlab code that I have to execute in order to complete a home assignment. I have always been using GNU Octave without troubles, but this time there is this command that is giving me…
wizclown
  • 313
  • 1
  • 4
  • 16
7
votes
4 answers

MATLAB curve-fitting, exponential vs linear

I have an array of data which, when plotted, looks like this. I need to use the polyfit command to determine the best fitting exponential for the time roughly between 1.7 and 2.3. I must also compare this exponential fit to a simple linear fit. I'm…
scimaks
  • 153
  • 1
  • 3
  • 12
7
votes
2 answers

python optimize.leastsq: fitting a circle to 3d set of points

I am trying to use circle fitting code for 3D data set. I have modified it for 3D points just adding z-coordinate where necessary. My modification works fine for one set of points and works bad for another. Please look at the code, if it has some…
user1329187
7
votes
1 answer

gaussian fit with scipy.optimize.curve_fit in python with wrong results

I am having some trouble to fit a gaussian to data. I think the problem is that most of the elements are close to zero, and there not many points to actually be fitted. But in any case, I think they make a good dataset to fit, and I don't get what…
Álvaro
  • 1,219
  • 2
  • 12
  • 20
7
votes
2 answers

Fitting a curve to specific data

I have the following data in my thesis: 28 45 91 14 102 11 393 5 4492 1.77 I need to fit a curve into this. If I plot it, then this is what I get. I think some kind of exponential curve should fit this data. I am using GNUplot. Can someone tell…
The Flying Dutchman
  • 582
  • 2
  • 7
  • 18