fitting cumulative normal distribution to data and converting back to pdf

Hi,
I have fit a cumulative normal distrubtion to data. it fits fine when i overlay the plots. The total sum of the volume fraction, Volfrac, equals 1. the first column in the list below is z, the seconf column, volume fraction, Volfrac. I posted the data here as i usually call it from my excel file. when i take the derivative of the fitted data, diff(k)/diff(h), the sum is no longer 1. any suggestions as to what the problem could be?
0.00000001 0
1.1482E-08 0
1.3183E-08 0
1.5136E-08 0
1.7378E-08 0
1.9953E-08 0
2.2909E-08 0
2.6303E-08 0
3.02E-08 0
3.4674E-08 0
3.9811E-08 0
4.5709E-08 0
5.2481E-08 0
6.0256E-08 0
6.9183E-08 0
7.9433E-08 0
9.1201E-08 0
1.04713E-07 0
1.20226E-07 0
1.38038E-07 0
1.58489E-07 0
1.8197E-07 0
2.0893E-07 0
2.39883E-07 0
2.75423E-07 0
3.16228E-07 0
3.63078E-07 0
4.16869E-07 0
4.7863E-07 0
5.49541E-07 0
6.30957E-07 0
7.24436E-07 0
8.31764E-07 0
9.54993E-07 0
1.09648E-06 0
1.25893E-06 0
1.44544E-06 0
1.65959E-06 0
1.90546E-06 0
2.18776E-06 0
2.51189E-06 0
2.88403E-06 0
3.31131E-06 0
3.80189E-06 0
4.36516E-06 0
5.01187E-06 0
5.7544E-06 0
6.60693E-06 0
7.58578E-06 0
8.70964E-06 0
0.00001 0
1.14815E-05 0
1.31826E-05 0
1.51356E-05 0
1.7378E-05 0
1.99526E-05 0
2.29087E-05 0
2.63027E-05 0
3.01995E-05 0
3.46737E-05 0.009168
3.98107E-05 0.06717
4.57088E-05 0.08115
5.24807E-05 0.110426
6.0256E-05 0.148008
6.91831E-05 0.186588
7.94328E-05 0.220671
9.12011E-05 0.274696
0.000104713 0.415918
0.000120226 0.729263
0.000138038 1.234951
0.000158489 1.879436
0.00018197 2.531622
0.00020893 3.225123
0.000239883 4.236358
0.000275423 6.141223
0.000316228 9.268333
0.000363078 12.596915
0.000416869 15.190234
0.00047863 14.845459
0.000549541 12.136638
0.000630957 7.173257
0.000724436 4.021072
0.000831764 1.497577
0.000954993 0.83059
0.001096478 0.601582
0.001258925 0.340668
0.00144544 0.005905
0.001659587 0
0.001905461 0
0.002187762 0
0.002511886 0
0.002884032 0
0.003311311 0
0.003801894 0
0.004365158 0
0.005011872 0
0.005754399 0
0.006606934 0
0.007585776 0
0.008709636 0
0.01 0
function f=gauss(x,xdata)
mu=x(1);
sigma=x(2);
f = normcdf(xdata,mu,sigma);
end
z=(xlsread('graham.xlsx','Sheet2','b4:b104'));
Volfrac=(xlsread('graham.xlsx','Sheet2','c4:c104'))./100;
cumvolfrac=cumsum(Volfrac);
sigma=1;
mu=10e-3;
x0=[mu sigma];
x=lsqcurvefit(@gauss,x0,z,cumvolfrac);
h=0:0.1e-6:2000e-6;
k=normcdf(h,x(1),x(2));
p=diff(k);
q=diff(h);
pq=p./q;
sum(pq)
figure(1)
hold on
plot(h,k,'-r')
plot(z,cumvolfrac,'ob')

1 Comment

Have you tried 'diff' on a interpolated version of your CDF fitted data? It could just be a sampling issue

Sign in to comment.

Answers (0)

Categories

Asked:

on 6 Sep 2013

Community Treasure Hunt

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

Start Hunting!