Particle swarm optimization

attempts
to find a vector `x`

= particleswarm(`fun`

,`nvars`

)`x`

that achieves a local minimum
of `fun`

. `nvars`

is the dimension
(number of design variables) of `fun`

.

Passing Extra Parameters (Optimization Toolbox) explains how to pass extra parameters to the objective function, if necessary.

For a description of the particle swarm optimization algorithm, see Particle Swarm Optimization Algorithm.