With two different initial values I am getting two different answers in fsolve. How to decide which one is more reliable?
Mostra commenti meno recenti
function F = FeMnC300newuipf3variable(x)
F(1) =10.3014287+log(x(3))+3.37E+04*x(3)+(-3.37E+04*x(3)^2)/2-19.1333*0.03592*x(3)- log(x(1)) -21.4105*x(1)+10.41166*x(2)+(21.4105*x(1)^2)/2-10.41166*x(1)*x(2)+(1.99159*x(2)^2)/2;
F(2) =-0.269548173-log(x(2))+19.1333*x(3) +(-3.37E+04*x(3)^2)/2-19.1333*0.03592*x(3)+10.41166*x(1)-1.99159*x(2)+(21.4105*x(1)^2)/2-10.41166*x(1)*x(2)+(1.99159*x(2)^2)/2;
F(3) =-0.643539436+log(1-0.03592-x(3))-log(1-x(2)-x(1))+(-3.37E+04*x(3)^2)/2-19.1333*0.03592*x(3)+(21.4105*x(1)^2)/2-10.41166*x(1)*x(2)+(1.99159*x(2)^2)/2;
end
First initial value- x0 = [0.002 0.4 0.000000001]
Second initial value- x0 = [0.01 0.4 0.000000001]
2 Commenti
Alex Sha
il 10 Feb 2022
There is one solution only?
x1 0.00215170099218674
x2 0.406209428191469
x3 9.4346283948294E-10
Vikash Sahu
il 10 Feb 2022
Risposta accettata
Più risposte (1)
AndresVar
il 10 Feb 2022
The results are almost the same, but you can take a look at the display for each iteration see fsolve documentation, here is an example:
problem.options = optimoptions('fsolve','Display','iter','PlotFcn',@optimplotfirstorderopt);
problem.objective = @FeMnC300newuipf3variable;
problem.solver = 'fsolve';
problem.x0 = [0.002 0.4 0.000000001];
fsolve(problem)
problem.x0 = [0.01 0.4 0.000000001];
fsolve(problem)
The first guess has f(x) closer to 0.
You can also see why the solver converged and increase the tolerances or maximum iterations to see wether the solutions converge regardless of initial guess.
Categorie
Scopri di più su Solver Outputs and Iterative Display in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!