I have a famous model that I am trying to adapt to real data.
fun = @(b,x) b(1)*x(:,1)./(x(:,2).^b(2));
beta0 = [70 1.1]; % expected range is 40-130, and 1.0-1.3
[beta,r]=nlinfit(X,tmp_y,fun,beta0);
When I use nlinfit, it tells me that my function returns Inf values. I went into the code and found that in the second iteration of fitting it would overcompensate the second beta term, dropping it to -80. At very large values ββfor, x(:,2)this leads to division by zero for all values x.
Are there any options that I can set to prevent this from happening? I read the documentation, but I do not really understand what all the options actually do.
source
share