How do I fit "diamond" ellipsis curve?

84 Views Asked by At

I have bunch of x,y data that at first seem to be fittable with a logarithmic function. My current plot looks like this:

attempted fit

As you can see, the logarithmic fit using f(x,a,b,c) = a*log(b*x) +c doesn't work for high values of x_applied.

My guess is that the function that I need to fit these points is basically a half of a diamond shape (that's the name I googled for that shape). This is what the fit would (not really) look like. with diamond

I didn't know how to make a nice and symmetrical diamond in GIMP using the paths tool, so just imagine the the blue curve is symmetrical and doesn't have a dent in the middle.

So my question is: Is there a typical function for fitting data that looks like this? Fitting one half of a "diamond shape"? I think I remember similar graphs from the fractional distillation of azeotropes, but I couldn't find the exact thing I was looking for.

EDIT: I know the visible points can be fitted well with a quadratic function, but I know due to the chemical background knowledge that it cannot be a simple quadratic. If I use that as a fitting function, the last point will be fitted apporximately as the maximal turning point of the quadratic function. It has to be a diamond shape between 0 and 1. I could try to explain why that is, but it would be difficult...

EDIT2:

This is the numerical data I am trying to fit:

#Zn 
x_applied   x_found
0.009   0.02
0.012   0.03
0.016   0.05
0.024   0.07
0.047   0.12
0.069   0.17
0.13    0.24
0.25    0.35
1

There are 1 best solutions below

0
On BEST ANSWER

The diamond shape is a particular case of superellipse : https://mathworld.wolfram.com/Superellipse.html

If we choose the equation of superellipse as model the result is shown below. $$\left|\frac{x-x_0}{a}\right|^p +\left|\frac{y-y_0}{b}\right|^p=1 \tag 1$$ The condition for the vertexes be $(0,0)$ and $(1,1)$ implies $x_0=-1$ , $y_0=0$ , $a=b=1$. The equation becomes : $$|x-1|^p+|y|^p=1 \tag 2$$ We consider the arc of superellipse in the range $0<x<1$ and $0<y<1$. The equation is : $$(1-x)^p+y^p=1 \tag 3$$ Thanks to any software for nonlinear regression the result (with criteria of fitting LMSE wrt Eq.3 ) is:

enter image description here

The fitting is not very good with equation $(3)$. This is due to the conditions specified for the vertexes.

With the more general equation $(1)$ the accuracy is much better. But the shape isn't as expected on your second graph :

enter image description here