Matlab nlinfit diverges

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.

+3
source share
1 answer

, , , . , . b (i) c (i) = ln (b (i)), , b (i) = exp (c (i)). b (i) exp (c (i)) .

fun = @(c, x) exp (c (1)) * x (:, 1)./(x (:, 2). ^ exp (c (2)));

c (i) b (i) = exp (c (i)). , c (i) , b (i) .

0

All Articles