- an example dataset that works
 - an example dataset that gives the error
 - minimal amount of code that demonstrates the error
 
I am using the fitnlm function, but for some data I am receiving this error - Error using nlinfit>checkFunVals The function you provided as the MODELFUN input has returned Inf
    3 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
 Hi, 
I am using fitnlm function to find a non-linea fit for sets of data. This is the function handle:  F = @(b,mu)((mu.^(2*b(2)-1)).*exp(4*b(1)*(log(mu)).^2 + b(3)));
 mu is an array ranging from 0.3 - 0.9, and the value of b changes per iteration (the function is within a loop) with the range of b(1): 0.01 - 0.03, b(2) = 0 - 1, b3 = 0 -100. The function works for some iterations but not for others. If you plug the values into the function manually, it is all fine.
The error I am recieving is "Error using nlinfit>checkFunVals The function you provided as the MODELFUN input has returned Inf" within "Error in nlinfit>LMfit (line 596)"
    if funValCheck && ~isfinite(sse), checkFunVals(r); end
if you plug the values into the function manually, it is all fine. Warnings also appear for some iterations like: 
"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, or otherwise 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. "  &  "Warning: Rank deficient, rank = 0, tol =  0.000000e+00."
Please could someone help? 
Thanks, 
Josh 
4 Commenti
  Torsten
      
      
 il 18 Gen 2024
				Try whether
F = @(b,mu) b(3)*mu.^b(2).*exp(b(1)*(log(mu)).^2)
instead of
F = @(b,mu)((mu.^(2*b(2)-1)).*exp(4*b(1)*(log(mu)).^2 + b(3)));
works better.
It's easy to deduce the parameters of the original equation once you can solve the modified one.
Risposte (0)
Vedere anche
Categorie
				Scopri di più su Linear and Nonlinear Regression in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!