I need to fit a Gauss curve to the tails of curve as shown in the picture, to calculate the area below the curve. I tried to use the code below without success. I'm using the wrong method ?
There is a better way to do it ?
I successfully did it for a Gaussian curve using the examples in the page https://www.mathworks.com/help/curvefit/fitoptions.html, shown in the picture. However, when I applied the same method to my curve it didn't work.
I tried using both, the std from the original curve and the std from a fitted Gaussian curve.
Here is my code (I attached the gdata.m file):
load('gdata.mat');x = (1:1:129)';% mystd = std(gdata)
gfit1= fit(x,gdata,'gauss2');YHat = gfit1(x);mystd = std(YHat)gfit2= fit(x,gdata,'gauss2','Exclude', gdata > (2*mystd));
Best Answer