0

I need to fit a function to this particular set of data points, but I can't find anything with this general form. I have found a great fit for the inverse of this graph using the form

$$x(y) = \frac{a}{b\exp{(cy-y_c)}+d}+e$$

with the values $a=25.0989,\, b=0.2459,\, c=3.1954,\, d=0.0961,\, e=2.8681,\, y_c=-2.1852$, but inverting this function gives me

$$y(x) = \left[\ln{\left(\frac{a}{x-e}-d\right)} - \ln{(b)} + y_c \right]/c$$

at, say, x = 0 or x = 265 the logarithm is undefined. How can I obtain a function valid over the entire range [0, 265]?

Data points: $$x = [0, 5, 17, 27, 38, 74, 137, 161, 184, 209, 239, 253, 265]$$ $$y = [2.8808, 0.4771, 0, -0.2218, -0.3979, -0.6990, -1.0000, -1.0969, -1.2218, -1.3979, -1.6990, -2.0000, -3.0000]$$

Edit: included data values;

Edit 2: rewrote fit equation in terms of y for coherence; added inverse function to better demonstrate the issue; added calculated coefficients;

Edit 3: change 'e' to 'exp' for clarity.

  • 1
    It would be much easier to work with the data if you give the numerical values. – Matti P. Jul 04 '18 at 06:00
  • Added the numerical values if that helps, but all I'm looking for is an analytical function with that general shape. – Matheus Leão Jul 04 '18 at 06:30
  • I don't see the problem with inverting your $f(x)$. You subtract $e$, invert, multiply by $a$, subtract $d$, divide by $b$, take the log, add $x_c$, and divide by $c$. – Gerry Myerson Jul 04 '18 at 06:48
  • Doing that will give me complex values for certain point. All the coefficients are positive, so popping x = 0 into that equation results in a natural logarithm of a negative number, which doesn't have a real answer. – Matheus Leão Jul 04 '18 at 08:49
  • Are you using $e$ with two meanings: Euler's $2.71828\ldots$ and your calculated $2.8681$? – Henry Jul 04 '18 at 09:05
  • My bad, the first is the exponential function, the second is just a constant. Fixed the notation now. – Matheus Leão Jul 04 '18 at 09:08
  • Notice such equation is only applicable on a certain range. The condition of applying this equation is $$\frac a{x-e}-d>0$$ The case $x<e$ is clearly inapplicable. For $x>e$,$2.8681<x<\frac ad+e\approx 264.04292$ – Mythomorphic Jul 04 '18 at 09:18

1 Answers1

1

Even though I didn't find a better analytical solution, most of my data points ended up falling within the range of the logarithm function, so I just defined a piecewise function instead, setting the values I wanted for outlier points. An ugly solution, but works.