Error in using nlinfit function
6 views (last 30 days)
Show older comments
I need to fit some parameters using nlinfit but getting following warning on running the code. May I please get some advice, how can I resolve this issue. Required codes and data file is provided here.
Warning: Some columns of the Jacobian are effectively zero at the solution, indicating that the model is insensitive to some of its parameters. That may be because those parameters are not present in the model, orotherwise do not affect the predicted values. It may also be due to numerical underflow in the model function, which can sometimes be avoided by choosing better initial parameter values, or by rescaling or recentering.
Parameter estimates may be unreliable.
> In nlinfit (line 381)
In BinartI2WLfit (line 19)
%%Determine the values of binary paarmeters of E-NRTL model
function [yk]=BinaryI2WL(taua,x)
%1-H2O
%2-I2
filename = 'KracekLLE.xlsx'; %reading VLE data from excel file
Data = xlsread(filename);
x(:,1) = Data(:,7);
x(:,2) = Data(:,6);
T=[399.5000
416.2000
428.4000
429.4000
448.9000
460.4000
461.4000
479.7000];
N=length(T);
alpha12=0.3*ones(N,1); alpha21=0.3*ones(N,1);
tau12=zeros(N,1); tau21=zeros(N,1);
taua=[randi([-10,10]) randi([-10,10]) randi([-500 1000]) randi([-500 1000])];
for i=1:N
tau12(i)=taua(1)+taua(3)/T(i);
tau21(i)=taua(2)+taua(4)/T(i);
end
G12=exp(-(tau12.*alpha12));
G21=exp(-(tau21.*alpha21));
X1=x(:,1);
X2=x(:,2);
ln_y1_1=G21.*X2.*tau21;
ln_y1_2=G21.*X2;
ln_y2_1=G12.*X1.*tau12;
ln_y2_2=G12.*X1;
ln_y1_3=(((X2.*G12)./ln_y2_2).*(tau12-(ln_y2_1)./(ln_y2_2)));
yk=exp((ln_y1_1./ln_y1_2) + ln_y1_3) ; %% activity coefficient for H2O
end
%%Calling BinaryI2WL function
for i=1:4
yk=[0.6717
0.6825
0.6899
0.6905
0.7017
0.7080
0.7085
0.7179];
%initial guess for parameters
taua=[1,0,702,-159];
try % try-catch used to continue the loop without stopping on encountering an error
[taua1]= nlinfit(x,yk,@BinaryI2WL,taua);
catch exception
continue
end
end
0 Comments
See Also
Categories
Find more on Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!