Optimize - Optimize in the Live Editor - MATLAB (original) (raw)

Main Content

Optimize in the Live Editor

Since R2020b

Description

The Optimize task lets you interactively optimize a nonlinear objective function or solve a nonlinear equation. The task automatically generates MATLAB® code for your live script.

Using this task, you can:

If you have Optimization Toolbox™ or Global Optimization Toolbox you can solve more problem types using theOptimize task, such as solve a system of nonlinear equations or optimize an objective function with nonlinear constraints. For general information about Live Editor tasks, see Add Interactive Tasks to a Live Script.

Optimize task in Live Editor

Open the Task

To add the Optimize task to a live script in the MATLAB Editor, on the Live Editor Insert tab, select .

Insert Optimize Live Editor task

Alternatively, in a code block in the script, type a relevant keyword, such asfminbnd. Select from the suggested command completions.

Choosing Optimize from command completion suggestions

Parameters

expand all

Optimization solver that MATLAB uses to solve the problem, specified as one of these solvers:

Example: fminsearch

Function to minimize (for fminbnd orfminsearch) or to find a root (for fzero), specified as a function handle, local function name, or function file.

Tips

Version History

Introduced in R2020b