Why I got a waring

% 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 comentario

Alex Sha
Alex Sha el 24 de Oct. de 2022
Here are solution:
x1: 446505.431672108
x2: 0.912262916225994
x3: 0.0148006249649759

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 23 de Oct. de 2022

0 votos

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.

Categorías

Más información sobre Programming en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Oct. de 2022

Comentada:

el 24 de Oct. de 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by