How to fix error of this type: "Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue"
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to solve a system of nonlinear equations with fsolve command. The function script is:
function F = eqn1(z)
z(6) = 0.01:0.01:0.01;
F(1) = z(1) + z(2) + z(3) -1;
F(2) = z(4) + z(5) + z(6) -1;
F(3) = z(1).*(10.^((1.167.*(z(2)).^2 +0.8085.*z(2).*z(3))./((z(1)+1.168.*z(2)+z(3)).^2))) - z(4).*(10.^((1.167.*(z(5)).^2 +0.8085.*z(5).*z(6))./((z(4)+1.168.*z(5)+z(6)).^2)));
F(4) = z(2).*(10.^((1.733.*(z(1)).^2 +0.383.*z(1).*z(3)+0.046.*(z(3)).^2)./((z(2)+0.856.*z(1)+z(3)).^2)) - z(5).*(10.^((1.733.*(z(4)).^2 +0.383.*z(4).*z(6)+0.046.*(z(6)).^2))./((z(5)+0.856.*z(4)+z(6)).^2)));
F(5) = z(3).*(10.^((2.019.*(z(2)).^2 -0.4252.*z(2).z(1))./((1.168.*z(2)+3.5215.*z(1)+z(3)).^2))) - z(6).*(10.^((2.019.*(z(5)).^2 -0.4252.*z(5).*z(4))./((1.168.*z(5)+3.5215.*z(4)+z(6)).^2)));
end
And the call to fsolve is:
fun = @eqn1;
z0 = [1 0 0 0 1];
z = fsolve(fun,z0)
but its showing
Error in eqn2_solver (line 3)
z = fsolve(fun,z0)
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
How can I fix this?? Thanks!!
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur Systems of Nonlinear Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!