Home \ Metaheuristics \ Particle Swarm Optimization (PSO) in MATLAB – Video Tutorial
Particle Swarm Optimization (PSO) in MATLAB -- Video Tutorial

Particle Swarm Optimization (PSO) in MATLAB – Video Tutorial

Particle Swarm Optimization (PSO) is an intelligent algorithm leveraging principles from Swarm Intelligence, inspired by the social behavior of birds and fish. Learning PSO is crucial for tackling complex optimization problems efficiently. MATLAB serves as an excellent platform for mastering PSO, offering practical implementation and adaptability to other languages. This course, led by Dr. S. Mostapha Kalami Heris, provides a comprehensive tutorial on PSO, ensuring learners grasp its fundamentals and practical applications across various domains.

What is Particle Swarm Optimization (PSO) in simple words?

Particle swarm optimization (PSO) is an algorithm that tries to find the best solution to a problem. It is inspired by the social behavior of animals like birds flocking or fish schooling.

In PSO, each possible solution is represented by an individual “particle” in a swarm. The particles fly around in a multi-dimensional search space looking for the best location. Every particle keeps track of the best solution it has found, and shares this information with neighboring particles. If one particle discovers a promising area, other particles will start moving there too.

What is PSO particle swarm optimization

By repeating this communication and movement, particles guide the overall swarm toward better solutions through collaboration. Eventually, the swarm converges on optimal or near-optimal solutions. PSO balances exploring new areas and exploiting the best known regions efficiently. That’s the essence of how PSO works!

Why do we use Particle Swarm Optimization and why is it important to learn it?

Particle Swarm Optimization (PSO) finds its importance in solving complex optimization problems where traditional methods may struggle. Whether in engineering, finance, or data science, PSO excels in finding optimal solutions by leveraging collective intelligence, making it a valuable tool in various fields.

For engineers and researchers, PSO offers a powerful approach to tackle intricate problems like system optimization, parameter tuning, and design challenges. In finance, PSO aids in portfolio optimization, risk management, and algorithmic trading strategy development. Data scientists benefit from PSO in tasks such as feature selection, model calibration, and hyperparameter tuning, enhancing the efficiency of machine learning algorithms.

Learning PSO is particularly crucial for professionals and students in engineering, finance, and data science, as it equips them with a versatile optimization tool. Mastering PSO opens doors to efficiently address real-world problems, providing a competitive edge in problem-solving across diverse industries.

About this Free Particle Swarm Optimization (PSO) Course

In this free Particle Swarm Optimization (PSO) course, we start by demystifying the fundamentals of PSO. We provide a clear understanding of what PSO is and its essential principles, laying a strong foundation for learners, whether beginners or those seeking a refresher on optimization techniques.

The course progresses into practical implementation by introducing the Sphere function as a model problem in MATLAB. We guide participants through the step-by-step process of implementing the Sphere model as a function, defining PSO as a function, and ultimately solving the model using PSO. This hands-on approach ensures that learners not only grasp the theoretical concepts but also gain practical experience in applying PSO to real-world optimization challenges.

As the course advances, we enhance the implemented code by converting the PSO code into a function. We delve into refining the code further by adding position and velocity bounds, optimizing the performance of the PSO algorithm. Additionally, we introduce constriction coefficients, elevating the efficiency and versatility of the PSO implementation. The course provides a comprehensive journey, equipping learners with practical skills in implementing and improving PSO algorithms using MATLAB.

In this video tutorial, implementation of Particle Swarm Optimization (PSO) in MATLAB is discussed in detail. In the first part, theoretical foundations of PSO is briefly reviewed. In the next two parts of this video tutorial, PSO is implemented line-by-line and from scratch, and every line of code is described in detail.

After watching this video tutorial, you will be able to know what is PSO, and how it works, and how you can use it to solve your own optimization problems. Also, you will learn how to implement PSO in MATLAB programming language. If you are familiar with other programming languages, it is easy to translate the MATLAB code and rewrite the PSO code in other programming languages.

What you will gain

Completing the PSO in MATLAB Free Online Course unlocks a world of optimization expertise. You will master the fundamentals of Particle Swarm Optimization (PSO), gaining a deep understanding of its principles and applications. Whether you’re a novice seeking an introduction to optimization or an experienced professional looking to expand your skill set, this course provides a comprehensive learning experience.

By the end of the course, you’ll be proficient in implementing PSO in MATLAB from scratch. You’ll learn to tackle real-world optimization problems, translating theoretical knowledge into practical solutions. The hands-on approach, guided by Dr. S. Mostapha Kalami Heris, a seasoned expert in control and systems engineering, ensures you not only grasp the concepts but also acquire the skills to apply them effectively.

Elevate your coding abilities as you convert PSO code into a function, add position and velocity bounds, and incorporate constriction coefficients. These advanced techniques empower you to optimize PSO algorithms for diverse applications. With newfound proficiency in MATLAB, you’ll confidently tackle optimization challenges, making this course an invaluable asset for both personal development and professional growth.

After completing this tutorial, you will learn:

  • What is Particle Swarm Optimization (PSO) and how it works
  • How to implement PSO in MATLAB from scratch
  • How to improve the PSO using Constriction Coefficients
  • How to solve optimization problems using PSO

PSO Course Outline and Content

The general PSO Course Outline and Content is as follows:

  • Introduction to PSO: Begin your journey by understanding the essence of Particle Swarm Optimization (PSO). Delve into the theoretical foundations laid by Kennedy and Eberhart in 1995, exploring the simplicity and power of this intelligent optimization algorithm.
  • MATLAB Implementation: Unlock the practical aspects as you implement PSO in MATLAB. Follow along with Dr. S. Mostapha Kalami Heris, gaining insights line-by-line as you build the PSO algorithm from scratch. The video tutorial ensures a detailed breakdown of the code, making complex concepts accessible.
  • Advanced Techniques and Applications: Elevate your skills by refining the PSO code. Convert it into a function, add position and velocity bounds, and introduce constriction coefficients. Explore how these advanced techniques enhance the adaptability and effectiveness of PSO, equipping you to tackle optimization challenges across various fields.

Topics covered in this part are listed below:

  • Introduction to Particle Swarm Optimization
  • Theoretical Foundations of PSO
    • History of PSO and its Simplified Model
    • Mathematical Model of PSO
  • Implementation of PSO in MATLAB
    • Optimization Problem Definition
    • PSO Parameters
    • Initialization of PSO
    • PSO Main Loop
    • Finalizing the Optimization Process
  • Improving the Code
    • Converting the Code to a Function
    • Adding Position and Velocity Bounds
    • Constriction Coefficients for PSO

This course includes:

  • More than one hour on-demand video
  • Access on PC, mobile, tablet and TV on different platforms such as Yarpiz website, Youtube, Udemy and Alison
  • Downloadable resources
  • Certificate available on Alison


  • Basic Programming Knowledge: A fundamental understanding of programming concepts is recommended for this course. Familiarity with MATLAB will be advantageous, but learners with experience in other programming languages can easily translate and apply the principles covered.
  • Interest in Optimization: This course is designed for individuals interested in optimization problems and metaheuristic algorithms. A keen interest in exploring efficient solutions to complex problems will enhance your learning experience.
  • MATLAB Software: To actively engage in the hands-on exercises and implement PSO, you need access to MATLAB software. Ensure that you have MATLAB installed on your system to practice and implement the concepts covered in the video tutorial.

Who can benefit from this course?

  • Engineering and Science Students: This course is ideal for students pursuing degrees in engineering or science disciplines. It provides a practical introduction to Particle Swarm Optimization (PSO) in MATLAB, a valuable skill for tackling real-world optimization challenges encountered in these fields.
  • Professionals in Optimization Fields: Professionals working in optimization-related roles, such as operations research, data science, and algorithm development, can enhance their skill set with PSO knowledge. The course equips them with practical implementation skills applicable across various industries.
  • Programming Enthusiasts: Individuals with a passion for programming and algorithmic problem-solving will find this course engaging. It caters to both beginners and those with some programming experience, offering insights into PSO and optimization techniques through hands-on MATLAB exercises.

About the Instructor

Dr. Mostapha Kalami Heris, your instructor for the “Practical Genetic Algorithm in Python and MATLAB” course, is a renowned expert in Control and Systems Engineering. Born in Heris, Iran, in 1983, he earned his B.S. from Tabriz University in 2006, his M.S. from Ferdowsi University of Mashhad in 2008, and his PhD from Khaje Nasir Toosi University of Technology in 2013, all in Control and Systems Engineering.

Dr. Mostapha Kalami Heris

Dr. Kalami is more than just an instructor; he is also a key member of the Yarpiz Team, which provides valuable academic resources and tutorials. His interests span a wide range of topics, including computer programming, machine learning, artificial intelligence, meta-heuristics, and control engineering. With his vast knowledge and expertise, Dr. Kalami is the ideal mentor to guide you through the exciting world of genetic algorithms, making complex concepts understandable and engaging for learners of all levels.

Who this course is for:

  • Students working on optimization problems and methods, specially engineering and science students, can use PSO as an optimization tool; so this course can help them to enhance their knowlodge about one of most useful meta-heuristics.
  • Anyone who is interested in artifical and computational intelligence will find this course useful

Watch Online

Three parts of this video tutorial are available on YouTube and they are embedded into this page as playlist.

Video Files

Part 1/3: Theoretical Foundations (YouTube or Direct Download as MP4 file)

Part 2/3: Implementation in MATLAB (YouTube or Direct Download as MP4 file)

Part 3/3: Improvements (YouTube or Direct Download as MP4 file)

Also the projects files and lecture notes, are available to download, via following URLs.

More About Particle Swarm Optimization

Particle Swarm Optimization (PSO) is an intelligent optimization algorithm based on the Swarm Intelligence. It is based on a simple mathematical model, developed by Kennedy and Eberhart in 1995, to describe the social behavior of birds and fish. The model relies mostly on the basic principles of self-organization which is used to describe the dynamics of complex systems. PSO utilizes a very simplified model of social behavior to solve the optimization problems, in a cooperative and intelligent framework. PSO is one of the most useful and famous metaheuristics and it is successfully applied to various optimization problems.


The download links of this project are listed below.

Project Files for Video Tutorial of Particle Swram Optimization (PSO) in MATLAB


Lecture Notes for Video Tutorial of Particle Swram Optimization (PSO) in MATLAB


Video tutorial of PSO in MATLAB - Part 1 of 3


Video tutorial of PSO in MATLAB - Part 2 of 3


Video tutorial of PSO in MATLAB - Part 3 of 3


Citing This Work

If you wish, you can cite this content as follows.

Cite as:

Mostapha Kalami Heris, Particle Swarm Optimization (PSO) in MATLAB – Video Tutorial (URL: https://yarpiz.com/440/ytea101-particle-swarm-optimization-pso-in-matlab-video-tutorial), Yarpiz, 2016.


  1. Thank you for the great tutorial.

  2. Thanks Yarpiz for your good educative videos. I have watched your tutorials on PSO and I really
    appreciate it so much

  3. Wonderful and plain explanation.

    Thank you very much.

  4. You are really a life savior !!!!

  5. Thankful
    I used this tutorial for my site

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.


Check Also

Numerical Computations

Numerical Computations in MATLAB — Video Tutorial

In this video tutorial, “Numerical Computations in MATLAB” has been reviewed. In fact, the built-in ...