MATLAB: Jacobian ill-conditioned nlinfit

jacobiannlinfit

Hi all,
I am trying to fit a diode IV curve with the lambertw function. I want two parameters to be determined. However, when I run the code, I get the error that the jacobian is ill-conditioned and the determined parameters may not be estimated well. The fit through the data seems good. I already looked around on the internet how to solve this, but cannot get my head around it. I know it has something to do with estimating 2 parameters instead of one or finding a local minimum instead of global?
I really have to work with this experimental data, so it is no option to get "better" data.
I also tried for other functions in stead of lambertw, but the error is the same.
I hope somebody can help me. 🙂
%define data to be fit
x=IVPP.data(1:29,1);
y=IVPP.data(1:29,PP);
%Define fit function with corresponding parameters
f = @(a,x) (-1*a(2))+(0.05/a(1))*lambertw((a(2)*a(1)/0.052)*exp((x+a(1)*a(2))/0.052));
F_fitted = nlinfit(x,y,f,[1e-10 2]);
%Display coefficients
disp(['C = ',num2str(F_fitted)])

Best Answer

The problem may be because ‘a(1)’ (if the initial estimate is reasonably accurate) is close to the precision limit for floating-point numbers. If the fit looks good and the parameter confidence intervals returned by nlparci do not include zero (have opposite signs), this may not be a problem. If it is, scaling the data (multiplying it by 1000 perhaps) and changing the initial estimates appropriately, then re-scaling back to the original parameter range may solve the problem.