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.

Convert function to optimization expression

`[out1,out2,...,outN] = fcn2optimexpr(fcn,in1,in2,...,inK)`

`[out1,out2,...,outN] = fcn2optimexpr(fcn,in1,in2,...,inK,Name,Value)`

To find the output size of each returned expression when you do not provide an
`OutputSize`

, `fcn2optimexpr`

evaluates your function
at the following point for each element of the problem variables.

If there is a finite upper bound

`ub`

and a finite lower bound`lb`

, the evaluation point is`(lb + ub)/2 + ((ub - lb)/2)*eps`

.If there is a finite lower bound and no upper bound, the evaluation point is

`lb + max(1,abs(lb))*eps`

.If there is a finite upper bound and no lower bound, the evaluation point is

`ub - max(1,abs(ub))*eps`

.If there are no bounds, the evaluation point is

`1 + eps`

.In addition, if the variable is specified as an integer, the evaluation point is

`floor`

of the point given previously.

It is possible that this evaluation point leads to an error in function evaluation. To
avoid this error, specify `OutputSize`

.