FUNCTION REFERENCE

fsolve

Solve a system of nonlinear equations fun(x) = 0.

Solve a system of nonlinear equations fun(x) = 0.

Syntax

x = fsolve(fun, x0)

Syntax

x = fsolve(fun, x0, options)

Syntax

[x, fval, exitflag, output, jacobian] = fsolve(...)

Trust-region dogleg on the Gauss-Newton model of sum(fun(x).^2): the step

mixes the Gauss-Newton step (least-squares solution of J*p = -F, so a

singular J still gives a step) with steepest descent inside a trust region.

Non-square systems use Levenberg-Marquardt with augmented QR solves; set

Algorithm to 'levenberg-marquardt' to use it for square systems too.

J is estimated by finite differences or is the second output of fun when

SpecifyObjectiveGradient is true. exitflag: 1 solved (norm(J'*F, Inf) within

OptimalityTolerance * max(1, norm(J0'*F0, Inf)) and

sum(F.^2) <= sqrt(FunctionTolerance)),

2 solved with a step below StepTolerance, 0 limit reached (MaxIterations 400,

MaxFunctionEvaluations 100*numel(x0)), -2 stopped at a point that is not a

root, such as a minimum of sum(F.^2) above zero, -3 trust-region collapse

without an improved point.

Example

x = fsolve(@(x) [x(1)^2 + x(2)^2 - 5; x(1)*x(2) - 2], [0.5; 3])   % [1; 2]

Differences from MATLAB: only 'trust-region-dogleg' and 'levenberg-marquardt';

the printed messages are MatRust's own.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.