Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Objective function or constraints

An `OptimizationExpression`

is an arithmetic expression in
terms of optimization variables for an objective function or for comparison in
constraints.

Create an optimization expression by performing operations on `OptimizationVariable`

objects. Use standard MATLAB^{®} arithmetic including taking powers, indexing, and concatenation
of optimization variables to create expressions. See Examples.

You can also create an optimization expression from a MATLAB function applied to optimization variables by using `fcn2optimexpr`

. For examples, see Create Expression from Nonlinear Function and Problem-Based Nonlinear Optimization.

Create an empty optimization expression by using `optimexpr`

.
Typically, you then fill the expression in a loop. For examples, see Create Optimization Expression by Looping and the `optimexpr`

function reference page.

`OptimizationConstraint`

| `OptimizationVariable`

| `evaluate`

| `fcn2optimexpr`

| `optimexpr`

| `showexpr`

| `writeexpr`