Here is a very simple version of PSO in Matlab. PSO is a very popular, population based metaheuristic algorithm that mimics swarming behavior and swarm intelligence in order to solve optimization problems.
The code below is intended to get you started working with PSO in Matlab or Octave. Best efforts were made to keep the code clean and easy to understand. Feel free to play with it and contact me with any questions.
I am working in PSO area