1

I have n points (up to 513 points) that I need to fit in

y = y0 + a*exp(b*x)

I have been using MathNet.Numerics.Fit.Exponential, but the problem is coeficient y0, or when I have negative Y points, the result is

(NaN, NaN)

Example Points just first 7 points

double[] x = {0.000311999989207834, 0.00033149998853332363, 0.00035099998785881326, 0.0003704999871843029, 0.0003899999865097925, 0.00040949998583528213, 0.00042899998516077176};
double[] y = {-1.414255976676941, -1.415171504020691, -1.406565546989441, -1.3984631299972534, -1.398417353630066, -1.4013928174972534, -1.4019421339035034};
Tuple<double, double> t1 = Fit.Exponential(x, y);

Also I tried to find the lowest Y point and then substract from all points, but I think its not proper way to do it.

Reference photo (what I want to get): Graph of points and fit Graph of points and fit

Ravi Makwana
  • 2,782
  • 1
  • 29
  • 41
Mr. SvaRoq
  • 11
  • 2
  • Adding a constant to the data, when fitted by a function including a constant, is absolutely no problem and legit. – mikuszefski Jan 11 '21 at 10:48

1 Answers1

0

A non-iterative method of fitting which doesn't requires initial guess of parameters is explained in https://fr.scribd.com/doc/14674814/Regressions-et-equations-integrales

With your simplified example the calculus and result are shown below.

enter image description here

enter image description here

If some specific criteria of fitting is specified you can use the above results as initial values of parameters in a software for iterative method of fitting.

JJacquelin
  • 1,529
  • 1
  • 9
  • 11