System of nonlinear equations
Specify a system of equations using optimization variables, and solve the system
using solve
.
Tip
For the full workflow, see Problem-Based Workflow for Solving Equations.
Create an EquationProblem
object by using the eqnproblem
function. Add equations to the problem by creating OptimizationEquality
objects and setting them as Equations
properties of the
EquationProblem
object.
prob = eqnproblem;
x = optimvar('x');
eqn = x^5 - x^4 + 3*x == 1/2;
prob.Equations.eqn = eqn;
Warning
The problem-based approach does not support complex values in an objective function, nonlinear equalities, or nonlinear inequalities. If a function calculation has a complex value, even as an intermediate value, the final result can be incorrect.
optimoptions | Create optimization options |
prob2struct | Convert optimization problem or equation problem to solver form |
show | Display information about optimization object |
solve | Solve optimization problem or equation problem |
varindex | Map problem variables to solver-based variable index |
write | Save optimization object description |
eqnproblem
| fcn2optimexpr
| OptimizationEquality
| optimvar
| show
| write