MATLAB Examples

This script contains the examples shown in the webinar titled Optimization Tips and Tricks: Getting Started using Optimization with MATLAB presented live on 21 August 2008. To view the

Find a minimum of a non-smooth objective function using the ga and patternsearch functions in the Global Optimization Toolbox. Traditional derivative-based optimization methods, like

Find a minimum of a stochastic objective function using patternsearch. It also shows how Optimization Toolbox™ solvers are not suitable for this type of problem. The example uses a simple

The importance of choosing an appropriate solver for optimization problems. It also shows that a single point of non-smoothness can cause problems for Optimization Toolbox™ solvers.

Visually how pattern search optimizes a function. The function is the height of the terrain near Mount Washington, as a function of the x-y location. In order to find the top of Mount

Minimize an objective function subject to nonlinear inequality constraints and bounds using pattern search.

Create and manage options for the pattern search function patternsearch using the optimoptions function in the Global Optimization Toolbox.

Create and minimize an objective function using Pattern Search in Global Optimization Toolbox.

Find the minimum of Rastrigin's function restricted so the first component of x is an integer. The components of x are further restricted to be in the region .

How @gacreationlinearfeasible, the default creation function for linearly constrained problems, creates a population for ga. The population is well-dispersed, and is biased to lie on

Solve a mixed integer engineering design problem using the Genetic Algorithm (ga) solver in Global Optimization Toolbox.

The use of a custom output function in the genetic algorithm solver ga. The custom output function performs the following tasks:

Create and manage options for the multiobjective genetic algorithm function gamultiobj using optimoptins in Global Optimization Toolbox.

Perform a multiobjective optimization using multiobjective genetic algorithm function gamultiobj in Global Optimization Toolbox.

Minimize an objective function subject to nonlinear inequality constraints and bounds using the Genetic Algorithm.

Use the genetic algorithm to minimize a function using a custom data type. The genetic algorithm is customized to solve the traveling salesman problem.

Create and manage options for the genetic algorithm function ga using optimoptions in the Global Optimization Toolbox.

Use a hybrid scheme to optimize a function using the Genetic Algorithm and another optimization method. ga can reach the region near an optimum point relatively quickly, but it can take many

Create and minimize a fitness function using the Genetic Algorithm in the Global Optimization Toolbox.

Fit a function to data using lsqcurvefit together with MultiStart.

This is a simple Evolutionary Multiobjective Optimization problem (two objectives).

Use the functions GlobalSearch and MultiStart.

Control vector parameterization, also known as direct sequential method, is one of the direct optimization methods for solving optimal control problems. The basic idea of direct

The purpose of this demo is to reconstruct a simple picture of several polygons. I start by generating 'numOfPolygons' polygons of random colors ( left upper corner in the figure), say it's

Simulates the movements of a swarm to minimize the objective function

This example was authored by the MathWorks community.

Optimize using the particleswarm solver. The particle swarm algorithm moves a population of particles called a swarm toward a minimum of an objective function. The velocity of each

Use an output function for particleswarm. The output function plots the range that the particles occupy in each dimension.

Optimize using the particleswarm solver.

Create and minimize an objective function using Simulated Annealing in the Global Optimization Toolbox.

Create and manage options for the simulated annealing function simulannealbnd using optimoptions in the Global Optimization Toolbox.

Use simulated annealing to minimize a function using a custom data type. Here simulated annealing is customized to solve the multiprocessor scheduling problem.

Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a location from the following list:

See all countries