Gauss Curve Point of Inflection

9 次查看(过去 30 天)
Hello everybody
I have a question regarding the finding the inflection point of a Gaussian curve.
I am creating a Gaussian curve (stated at the below graph and data) and I would like to find its inflection point exactly. I have many different shape curves as below stated one and I need to fix the inflection point finding methodology.
If you help me I would appreciate
Best Regards
X Y
0 -24,8
5 -21,2
10 -13,3
15 -6,1
20 -2,1
25 -0,5
30 -0,1
35 0,0
40 0,0
45 0,0
50 0,0
55 0,0
60 0,0
65 0,0
70 0,0
75 0,0
80 0,0
85 0,0
90 0,0
95 0,0
100 0,0
105 0,0
110 0,0
115 0,0
120 0,0
Bel2.jpg

采纳的回答

John D'Errico
John D'Errico 2018-12-16
编辑:John D'Errico 2018-12-16
Find the EXACT inflection point? Sorry, but you cannot do so.
At best, you can find an approximate inflection point, and that based on some assumptions.
Locating an inflection point means you need to find that point where the second derivative changes sign. Estimation of the derivative of a function from data is a noise amplifying procedure. The second derivative is a more difficult problem yet.
You have all of about 9 data points where there is any information content in your data. Points 8 and 9 are flat at 0, and anything past that is totally non-informative, i.e., effectively useless for the purpose at hand. Had you a million points beyond there, all exactly showing zero, you would have no more information content.
Ok, all of that said, this does not have the shape of a Gaussian. It is too skewed to be that. And you have little information to try to estimate the shape of a nonlinear model that is clearly skewed. Let me say at least, you have too little information to try to estimate it well.
So I might first use a spline, VERY carefully chosen to be monotonic, to be smooth, an increasing function, with a maximum at 0 and flat at the end, etc. The resulting spline fit looks like this:
Now, plot the second derivative. We want that point where the second derivative crosses zero.
That looks to happen between x=5 and x=10. The curve fit was very carefully done using my SLM toolbox.
Now, by extracting the second cubic polynomial segment from that curve, then twice differentiating that polynomial, I see:
C = slmpar(slm,'symabs');
C{2,2}
ans =
- 0.010859064803065913984436718919824*x^3 + 0.2915092654881325032190098056617*x^2 - 0.89229862513971478638064027677501*x - 22.668859404720219742623843472984
fpp = diff(C{2,2},2)
fpp =
0.5830185309762650064380196113234 - 0.065154388818395483906620313518943*x
xinflect = vpa(solve(fpp == 0),3)
xinflect =
8.95
So very careful computations here suggest the inflection point happens around 8.95. But seriously, even trying to pin that result down to plus or minus 1 is a silly task, asking for trouble. There simply is not enough information content in your data. In fact, it is only the first 3 data points that really give you any information about the location of that inflection point.
Note that had I tried to do the same thing to a spline created from a tool like pchip, I would have gotten the garbage such a computation merits, because had I done so using similar computations, I have located potential inflection points at three distinct locations, thus [8.15, 10.0, 11.3]. Essentially, we should see the same thing I told you above. The inflection point happens somewhere around 9 or 10, plus or minus 1.
I said above that my gut told me this curve is not in fact Gaussian in nature. That was because it did not seem symmetric. So let me plot the first derivative as estimated from the spline model.
As I said, it looks skewed, not truly a Gaussian. You don't have much information content there to be truly sure.
All of that before was based on a cubic regression spline fit, one done using great care to try to follow the data, while still be as useful as possible in the task of finding the inflection point. You have MANY curves to fit of this sort, and you seem to want to use a Gaussian. So, is there a simple way to try to extract the same information, without asking you to learn a lot about manipulating a spline along the way?
Lets try the curvefitting toolbox. A simple way to get a cumulative variant of a Gaussian is to use erf.
ft = fittype('a + b*erf((x-c)/d)')
ft =
General model:
ft(a,b,c,d,x) = a + b*erf((x-c)/d)
Here, the point of inflection is c. The upper asymptote is a + b. The lower asymptote is a-b. d is a scale parameter tha reflects the width of the transition region.
mdl = fit(x,y,ft,'startpoint',[-15 15 15 5])
mdl =
General model:
mdl(x) = a + b*erf((x-c)/d)
Coefficients (with 95% confidence bounds):
a = -13.31 (-13.58, -13.04)
b = 13.29 (13.01, 13.56)
c = 10.16 (9.909, 10.41)
d = 9.321 (8.93, 9.711)
plot(mdl),hold on,plot(x,y,'bo')
So if I assume a symmetrical relationship in this,
then I see an implied inflection point of somewhere between 9.9 and 10.4. But that presumed the presence of symmetry around that inflection point. With some greater effort and a result that will be less robust to problems in the data, I could probably get a subtly different result.
Finally, with very little effort made, if I want a really simple approximation to the inflection point, I could try this:
p3 = polyfit(x(1:4),y(1:4),3)
p3 =
-0.0066667 0.186 -0.043333 -24.8
roots(polyder(polyder(p3)))
ans =
9.3
That is, pass a cubic interpolating polynomial through the first 4 data points. Differentiate twice, then solve for the location of the root. Yup. Its reasonable, and I can't ask for more than that. 9.3 is consistant with the other approximations I've tried, and see how easy it was to locate.
Here is the resulting cubic polynomial, plotted against those first 4 data points. The vertical line in green indicates the location of the inflection point, as identified from that interpolant.
untitled.jpg
The point is, anything you do will give you an estimate of roughly, vaguely 9 to 10 for that inflection point, and asking for more than that is an impossible task.

更多回答(2 个)

Rock Bolt
Rock Bolt 2018-12-16
Dear John,
Thank you very much for your help, the answer "inflection point of somewhere between 9.9 and 10.4" seems much reasonable. As you said it is very hard to or almost impossible to find the exact point in this circumstance.
Again thank you very much
Regards

Bruno Luong
Bruno Luong 2018-12-16
编辑:Bruno Luong 2018-12-17
If you know the curve is Gaussian, the inflection points can be computed directly from curve parameters. For Gaussian curve centered at 0
y(x) = A * exp(-(x/s)^2)
the two inflection points are
x = -s/sqrt(2)
= +s/sqrt(2)
I dont't know what is A and s in your case, but by fitting the first 7 points x,y you have given above, I find
xy = [ 0 -24.8
5 -21.2
10 -13.3
15 -6.1
20 -2.1
25 -0.5
30 -0.1
35 0.0
40 0.0
45 0.0
50 0.0
55 0.0
60 0.0
65 0.0
70 0.0
75 0.0
80 0.0
85 0.0
90 0.0
95 0.0
100 0.0
105 0.0
110 0.0
115 0.0
120 0.0 ];
x = xy(:,1);
y = xy(:,2);
g = @(p,x) p(1)*exp(-(x/p(2)).^2);
f = @(p) sum((g(p,x(1:7))-y(1:7)).^2);
p = fmincon(f,[-25 10])
A and s are p(1) p(2) with
p =
-24.784752970266428 12.678494467438862
So the positive inflexion point is
>> xinflection = p(2)/sqrt(2)
ans =
8.965049413162143
Visual check fit and inflection point
xi = linspace(min(x),max(x),513);
yi = g(p,xi);
clf;
plot(x,y,'or',xi,yi,'b')
xline(xinflection)
xinflection.png

类别

Help CenterFile Exchange 中查找有关 Descriptive Statistics 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by