Why I got a waring
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
% Solve the system of equations starting at the point [0,0,0].
% PL = x(1); c = x(2); k = x(3);
% Initial guess is [0,0,0], you can change it accordingily
fun = @root2d;
x0 = [0,0,0];
x = fsolve(fun,x0)
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm instead.
No solution found.
fsolve stopped because the relative size of the current step is less than the
value of the step size tolerance, but the vector of function values
is not near zero as measured by the value of the function tolerance.
x = 1×3
1.0e+05 *
2.0192 -0.0000 0
function F = root2d(x)
F(1) = x(1) * exp(-x(2)*exp(-x(3)*0)) - 179323;
F(2) = x(1) * exp(-x(2)*exp(-x(3)*10)) - 203302;
F(2) = x(1) * exp(-x(2)*exp(-x(3)*20)) - 226542;
end
1 commentaire
Alex Sha
le 24 Oct 2022
Here are solution:
x1: 446505.431672108
x2: 0.912262916225994
x3: 0.0148006249649759
Réponses (1)
Walter Roberson
le 23 Oct 2022
You write to F(2) twice.
The warning is because the default algorithm requires square outputs from your function, such as 1x1 or 2x2. You want three outputs so you need to use a different algorithm. It is automatically switching algorithms for you but warns you that your choosen algorithm was not used.
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!