File Exchange

## Particle Swarm Optimization Simulation

version 1.1 (12.7 KB) by
an animated simulation of particles searching for the minima of a simple function

Updated 30 Nov 2014

An animated simulation of Particles in 2D searching for a global minima of a simple function using Particle Swarm Optimization algorithm

### Cite As

Sam Elshamy (2021). Particle Swarm Optimization Simulation (https://www.mathworks.com/matlabcentral/fileexchange/11559-particle-swarm-optimization-simulation), MATLAB Central File Exchange. Retrieved .

### Comments and Ratings (52)

Noutouy DUANGTA

Thanks for the code. Dear Sir, I am new learner to the PSO.
easy to understand and very close to the theoretical model of PSO.
as a starter in PSO, I am lucky to run through this code.

Ali Ali

Dear Mr. Wesam,

Hoping this finds you well,

I appreciate if you can tell me why you are using the formula below for updating your algorithm:
swarm(i, 1, 1) = swarm(i, 1, 1) + swarm(i, 2, 1)/1.3;
specifically (/1.3).

Nick Zheng

Perfect tools, easy to use, thanks a lot!

ILOMA DAVIS

Please help me with matlab programme or code for (1) generation of data on PSO; (2) training of the data to achieve stability of a microgrid.
Thank you

prince

i need the code for optimal location of DG using PSO......... help me pleas on this
mail id: chandan.786baba@gmail.com

abbas issa

Hello, I'm looking for simple matlab code for PSO that can optimize the base station placement in mobile communication based particle swarm optimization

Obed Kondo

Hello Sir,
Please, can you help me with a matlab programme on finding optimal location of wells (drilling petroleum wells) using PSO?
My objective function is maximization of Net Present Value in drilling oil wells

Please, kindly help me

Thank you
oskwame88@gmail.com

abdulfeta mehammed

i need the code for placement and sizing of DG using PSO can u help me pleas.

abdulfeta mehammed

i need the code for placement and sizing of DG can u help me pleas

RAJEEV RANJAN

can u help in optimizing...minimize
C=0.15247* P^2+ 38.5397*P+756.79800
1<=P<=60

Rejeki Tambun

Hello sir,
Can you help me to find the optimal placement and capacity of Distributed Generation by using PSO?
rejeki.tambun@yahoo.com

First, thanks for sharing this code.
I want to do an optimal sizing & placement of Distributed Generation on networks.
could you tell me how to write the objective function in matlab ?
Thank you

Do u know how Mr. Arif Rizvi ?

Arif Rizvi

Very nice code . I am new learner of matlab ,I am working on Placement of Distributed Generation on Smart Grid usinf PSO , Can any one give me this code explanation.I have a problem at line no 35. Why here use 1000 ?
swarm(:, 4, 1) = 1000;

Worawut Srisukkham

Lola

Hamza

I have a question
this code is too simple for my criteria.
is it possible to modify this code for multi-objective optimization.

Like
fitness=utility1*w1+utility2*w2

Hamza

awesome code.
very simple , easy to understand and very close to the theoretical model of PSO.
as a starter in PSO, I am lucky to run through this code.

marian farouk

i need to ask you if i have 7 variables how can i put them in the program

anum eman

easy to learn PSO realy

Tam

good work

nice work boy but can u please tell me how to find global maxima for PSO

Jukkrit Kluabwang

Very good! It is easy to learn PSO concept.
Thank you very much.

Sonki Prasetya

This is very useful in understanding PSO. Thank you for the share.

yap ee chiet

good work..it is easy to understand and we are able to observe the movement of particles..
Thanks!

Vinod

mostafa saeed

Milton

Good one!!, It is easy and simple to understand.

hu jia

Good code.thank you!!

Nice work!

Thank you !

Lyeyee Wong

May I know what is the function of 'Live_fn.m'?

Patrick

A very clear example...
Nice work.....

khalid haroun

Thanks a lot dear for your sharing us your code
with the best regard

mohammed med

nice

C Lunga

Igor S

Learned PSO on simple example :) Thanx!

Royalos Yin

It is a good tutorial tool.
Thank you.

jonghoon han

thanks

Sarayut Nonsiri

Thank you very much for your code.

rahim mozafari

thank you for sharing your code

mo ar

craig hudson

good code!

still not sure about what implications the [temp, gbest] line has in relation to the updated velocity but the rest I have picked up with relative ease!

Amr Yassin

Thank you Wesam for sharing your PSO code it was realy useuful and easy to use

Neil King

Nice, really nice. Simple but effective demonstration of how the algorithm works.

wang li

I love you!you are best!Thank you for sharing your code!

li chong

I expect one day i can write matlab program like you,you set me a example

Perfect Graphical Simulation is seen !!

Rafael Gomez

Nice example!!!

xuemei zhu

good

##### MATLAB Release Compatibility
Created with R2006a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!