Questions tagged [best-fit-curve]

Anything related to so-called curve-fitting algorithms, i.e. algorithms used to compute the best parameters of some given curve model which make the curve best approximate some data points, according to some given optimality criterion.

Anything related to so-called curve-fitting algorithms, i.e. algorithms used to compute the best parameters of some given curve model which make the curve best approximate some data points, according to some given optimality criterion.

An example of a curve-fitting problem is: finding the parameters m and q of the line equation y=mx+q so that the mean distance of a set of points from that line in the plane is minimal.

103 questions
31
votes
7 answers

Curve fitting unsorted points on a plane

Question: How do you fit a curve to points on a plane if they aren't single valued? For the example shown, how would one fit a curve (like the black one) to the noisy blue data? It's similar to spline smoothing, but I don't know the order of the…
tkw954
  • 940
  • 2
  • 10
  • 16
23
votes
6 answers

Simple multidimensional curve fitting

I have a bunch of data, generally in the form a, b, c, ..., y where y = f(a, b, c...) Most of them are three and four variables, and have 10k - 10M records. My general assumption is that they are algebraic in nature, something like: y = P1 a^E1 +…
user64258
  • 231
  • 1
  • 2
  • 4
17
votes
2 answers

How to draw Bezier Curve in Android

I have a requirement to create bezier curve in my project. For that purpose I am drawing a view with paint, but the problem is that I am not getting the exact shape for my need as mentioned in the picture below. So kindly help me with your solutions…
Chandru
  • 5,954
  • 11
  • 45
  • 85
7
votes
3 answers

How do I create a best-fit polynomial curve in Javascript?

I'm trying to calculate a best-fit curve for data using a 3-6 order polynomial. I found this tutorial: Cubic Regression (best fit line) in JavaScript First, I can't seem to get my outputs to remotely match the curve. jsbin here: …
ProDarwin
  • 141
  • 1
  • 6
5
votes
0 answers

Multi-curve detection in noisy images in Python

I have images similar to the one below. First of all, I am trying to detect the curves in these images. The curves I want to capture are marked on the image. Next, I want to fit these curves into the circle. I will use the radii of these circles as…
5
votes
1 answer

How to apply best fit line to time series in python

I am trying to apply a best fit line to time series showing NDVI over time but I keep running into errors. my x, in this case, are different dates as strings that are not evenly spaced and y is the NDVI value for use each date. When I use the…
Selena Chavez
  • 139
  • 2
  • 10
5
votes
1 answer

Plot a best fit line R

Right now i have a large data set with temperature going up and down all the time. I want to smoothen my data and plot the best fit line with all the temperature, Here is the data: weather.data date mtemp 1 2008-01-01 12.9 …
londwwq1
  • 157
  • 3
  • 3
  • 7
4
votes
3 answers

How to find a best fit circle/ellipse using R?

I've been reading about a few methods to fit a circle to data (like this). I would like to see how the methods work on real data and thought of using R for this. I tried searching rseek for packages that can help with this but came up with nothing…
mauna
  • 1,098
  • 13
  • 25
4
votes
1 answer

Best path between two curves

My aim is to find a smooth best fit line between this two circuit curvy shapes. Is there any algorithm betten than mine that can find a set of points (or a curve) between two lines like this example? The algorithm I have so far takes the inner part…
4
votes
5 answers

Fitting a step function

I am trying to fit a step function using scipy.optimize.leastsq. Consider the following example: import numpy as np from scipy.optimize import leastsq def fitfunc(p, x): y = np.zeros(x.shape) y[x < p[0]] = p[1] y[p[0] < x] = p[2] …
astrofrog
  • 32,883
  • 32
  • 90
  • 131
3
votes
0 answers

How to generate the best curved fit for an unknown set of 2D points in C++

I am trying to get the best fit for an unknown set of 2D points. The points are centered points of rivers, and they don't come in a certain order. I've tried to use polynomial regression but I don't know what is the best polynomial order for…
Monica
  • 31
  • 4
3
votes
1 answer

Which polynomial regression degree is significant ? depends of number of points or other parameters?

I am studying the stability of numerical derivatives as a function of the step I take to compute these derivatives. With a derivative with 15 points (obtained by the finite difference method), I get the following plot (each multipole "l" corresponds…
user1773603
3
votes
3 answers

PYTHON: line of best fit for multiple y values per x value

I am plotting a 1d array (x-axis) against a 2d array (y-axis)in matplotlib so there are multiple y values for each x value. I want to plot a straigt line of best fit (linear regression), not just a line joining the points. How can I do this??? All…
Kai Mason
  • 31
  • 1
  • 5
3
votes
3 answers

how to set up the initial value for curve_fit to find the best optimizing, not just local optimizing?

I am trying to fit a power-law function, and in order to find the best fit parameter. However, I find that if the initial guess of parameter is different, the "best fit" output is different. Unless I find the right initial guess, I can get the best…
Zed Fang
  • 823
  • 2
  • 13
  • 24
3
votes
1 answer

Visualizing longitudinal data with a trajectory/best-fitting mean growth curve and a spaghetti plot using R

I have a longitudinal dataset with two groups of diagnoses I want to visually compare. Each subject has either one, two, or three data points and a number of dependent variables. Here's a sample of the data: dput(sample) structure(list(id =…
nisa
  • 33
  • 1
  • 5
1
2 3 4 5 6 7