Main Content

Systems of Nonlinear Equations

Solve systems of nonlinear equations in serial or parallel

Find a solution to a multivariable nonlinear equation F(x) = 0. You can also solve a scalar equation or linear system of equations, or a system represented by F(x) = G(x) in the problem-based approach (equivalent to F(x) – G(x) = 0 in the solver-based approach). For nonlinear systems, solvers convert the equation-solving problem to the optimization problem of minimizing the sum of squares of the components of F, namely min(∑Fi2(x)). Linear and scalar equations have different solution algorithms; see Equation Solving Algorithms.

Before you begin to solve an optimization problem, you must choose the appropriate approach: problem-based or solver-based. For details, see First Choose Problem-Based or Solver-Based Approach.

For the problem-based approach, create problem variables, and then represent the equations in terms of these variables. For the problem-based steps to take, see Problem-Based Workflow for Solving Equations. To solve the resulting problem, use solve.

For the solver-based steps to take, including defining the objective function and choosing the appropriate solver, see Solver-Based Optimization Problem Setup.

Functions

expand all

eqnproblemCreate equation problem (Since R2019b)
evaluateEvaluate optimization expression or objectives and constraints in problem
infeasibilityConstraint violation at a point
optimeqCreate empty optimization equality array (Since R2019b)
optimvarCreate optimization variables
prob2structConvert optimization problem or equation problem to solver form
showDisplay information about optimization object (Since R2019b)
solveSolve optimization problem or equation problem
writeSave optimization object description (Since R2019b)
fsolveSolve system of nonlinear equations
fzeroRoot of nonlinear function
lsqlinSolve constrained linear least-squares problems
lsqnonlinSolve nonlinear least-squares (nonlinear data-fitting) problems
checkGradientsCheck first derivative function against finite-difference approximation (Since R2023b)

Live Editor Tasks

OptimizeOptimize or solve equations in the Live Editor (Since R2020b)

Objects

EquationProblemSystem of nonlinear equations (Since R2019b)
OptimizationEqualityEqualities and equality constraints (Since R2019b)
OptimizationExpressionArithmetic or functional expression in terms of optimization variables
OptimizationVariableVariable for optimization

Topics

Problem-Based Systems of Nonlinear Equations

Solver-Based Systems of Nonlinear Equations

Code Generation

Parallel Computing

Algorithms and Options