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

Polyfit degree from horizontal

In my project, I have a best-fit line for some points which I got using np.polyfit. With that, I want to calculate the degree between the returned best-fit line and the horizon. As if the first point in the best-fit line were at the origin. Some of…
hellowill89
  • 1,538
  • 2
  • 15
  • 26
1
vote
1 answer

Prediction from Nonlinear Least Squares Fits in R

I'm trying to get some coeficients with nls and some basic data to be able to transform rssi in distance. So far I've been able to get the fit from 'nls' function but I'm unable to use the 'predict' function to see if the fit is correct. Maybe I'm…
Eylen
  • 2,617
  • 4
  • 27
  • 42
1
vote
3 answers

Decay curve best fit SciPy

I am having a problem when I try to find best fit to my data. Using scipy.optimize.curve_fit to create best fit. My data and code is: EDIT You can download the data file from here. data is, a b b2 55478 1.07E+43 …
anniejcannon
  • 143
  • 9
1
vote
0 answers

Octave leasqr only doing one iteration

As I'm trying to fit a function to some experimental data, I've written a function with three inputs, three parameters and one output: qrfunc = @(x, p) exp(-1*p(1)*x(:,1) - p(2)*x(:,2))+p(3)*x(:,3)+20; When I generate some input and output…
DrDonut
  • 864
  • 14
  • 26
1
vote
0 answers

Fit curve to social media shares

I'm trying to fit a curve to get an estimation function of the number of likes a news article have as a function of the articles age. I have a dataset with 5000 datapoints. X-axis is time since publication in hours and y-axis is the number of shares…
Daniel Falk
  • 522
  • 4
  • 16
1
vote
1 answer

Matlab how define an integral function and find best coefficients

I would like to find coefficients to best fit the nonlinear functions, and the nonlinear functions was an integral function. So the first step was to define an function: function dT = km(x,sT) fun=@(temp)((-x(1)*x(2)*(temp).^(x(2)-1.0))./ ... …
just_rookie
  • 873
  • 12
  • 33
1
vote
2 answers

MATLAB - Fit exponential curve WITHOUT toolbox

I want to fit a decaying exponential to the plotted data. I do NOT have the Curve Fitting or Optimization Toolboxes. x = [0 0.0036 0.0071 0.0107 0.0143 0.0178 0.0214 0.0250 0.0285 0.0321 0.0357 0.0392 0.0428 …
Trenera
  • 1,435
  • 7
  • 29
  • 44
1
vote
2 answers

Scipy - optimize. Find ratio between two variables

I have 3 variables; Market_Price, Hours, Age. Using optimize I found the relationship between each of the variables and the Market_Price. Data: hours = [1000, 10000, 11000, 11000, 15000, 18000, 37000, 24000, 28000, 28000, 42000, 46000,…
DGDD
  • 1,370
  • 7
  • 19
  • 36
0
votes
0 answers

Negative fitted curve extrapolation

Good day, I am currently working with a set of data imported from a csv file. I have y values and x values (See image attached) that I am trying to extrapolate (to Age 100) and plot on a plane. My problem however, is that each polynomial fit…
Bottle
  • 23
  • 4
0
votes
0 answers

In python, can I define a polynomial function with a user-defined power and coefficients, that I can reference for future calculations?

Some preface, I have been teaching myself python for the past few days for a project, with almost no history of coding beyond some dabbling with MATLAB, so I apologize if there is something very obvious I have missed that can solve this problem. As…
0
votes
0 answers

How to find the best combination of pairs in this particular problem?

I have a set of pairs of numbers each associated with a benefit. for example: (x,y)|benefit S={(2,3)|4,(4,5)|6,(6,7)|1,(8,9)|3} and let B(X) be a function that sum all the benefits in the set for example B(S)=4+6+1+3=14 and let R(X) be a function of…
0
votes
0 answers

Are large coefficients resulting from a best-fit process bad or not?

By performing the best fit of a data set, we can get an acceptable or even a good value of R^2. However, one or more of the best-fit coefficients might be quite large, or even exceptionally large, as shown in the figure here below. Are large…
limone
  • 279
  • 2
  • 9
0
votes
0 answers

How to fit the data obtained from 2d binning?

I have 2 data sets, I see there is a correlation. But the line of best fit is being strongly influenced a few denser regions in the scatter plot. So I decided to use matplotlib.pyplot.hist2d for 2d binning. Now I am curious to see if there is an…
Vara
  • 1
  • 1
0
votes
0 answers

Linear vs convex relationship: testing which one fits better

I performed a Mantel regression test between two distance matrices, using residuals to control for a third variable. The Mantel test shows a significant relationship between my two variables (residualsA vs residualsB). However, when I plot…
Tweety
  • 11
  • 2
0
votes
1 answer

How can I plot and curve fit multiple data sets within one data frame? in R

I have this df tree sdepth shallow_avg ddepth deep_avg swdepth sw_avg 1 3 2 0.0857 3.5 0.0454 3.7 0 2 4 2 0.142 3.5 0.0991 4.1 0 3 …
DCB
  • 33
  • 4