- 30

- 0

gaus = @(p,xdata) (p(1)/(sqrt(2*pi*p(2)))*exp(-(xdata-p(3)).^2/(2*p(2)))+min).*weights;

[g_pfit,g_residual,g_J]=nlinfit(data(:,1), data(:,2).*weights, gaus, [4030 2 -5]);

g_ci=nlparci(g_pfit,g_residual,'jacobian',J,'alpha',0.317);

loren = @(p,xdata) p(1)./(pi*p(2)*(1+((xdata-p(3))./p(2)).^2))+p(4);

[l_pfit,l_residual,l_J]=nlinfit(data(:,1), data(:,2), loren, [10030 0.5 -5 4]);

l_ci=nlparci(l_pfit,l_residual,'jacobian',l_J,'alpha',0.317);

The strange thing, however, is that my data is more like Gaussian-shaped and Gaussian curve, is by eye way more better fit. Still I get smaller errors for the width of Lorentzian fit than Gaussian (using the nlparci function).

Why would I get smaller errors for the width of the Lorentzian curve than for the width of the Gaussian curve, which is a better fit?

deccard