| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Genetic Algorithm and Direct Search Toolbox |
| Contents | Index |
| Learn more about Genetic Algorithm and Direct Search Toolbox |
| On this page… |
|---|
To perform a pattern search on an unconstrained problem at the command line, call the function patternsearch with the syntax
[x fval] = patternsearch(@objfun, x0)
where
@objfun is a handle to the objective function.
x0 is the starting point for the pattern search.
The results are:
x — Point at which the final value is attained
fval — Final value of the objective function
Performing a Pattern Search from the Command Line explains in detail how to use the patternsearch function.
To open the Optimization Tool, enter
optimtool('patternsearch')
at the command line, or enter optimtool and then choose patternsearch from the Solver menu.

You can also start the tool from the MATLAB Start menu as pictured:

To use the Optimization Tool, first enter the following information:
Objective function — The objective function you want to minimize. Enter the objective function in the form @objfun, where objfun.m is an M-file that computes the objective function. The @ sign creates a function handle to objfun.
Start point — The initial point at which the algorithm starts the optimization.
In the Constraints pane, enter linear constraints, bounds, or a nonlinear constraint function as a function handle for the problem. If the problem is unconstrained, leave these fields blank.
Then, click Start. The tool displays the results of the optimization in the Run solver and view results pane.
In the Options pane, set the options for the pattern search. To view the options in a category, click the + sign next to it.
Finding the Minimum of the Function gives an example of using the Optimization Tool.
The Optimization Tool chapter in the Optimization Toolbox User's Guide provides a detailed description of the Optimization Tool.
![]() | What Is Direct Search? | Example — Finding the Minimum of a Function Using the GPS Algorithm | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |