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.

Particle swarm optimization

`x = particleswarm(fun,nvars)`

`x = particleswarm(fun,nvars,lb,ub)`

`x = particleswarm(fun,nvars,lb,ub,options)`

`x = particleswarm(problem)`

```
[x,fval,exitflag,output]
= particleswarm(___)
```

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.