## How to find the search path list inside MATLAB?

All the saved and default paths that MATLAB looks inside to find a function are stored in an m-file called pathdef.m. You can easily use the which command to do this:

which pathdef.m -all


The result would be something like this:

C:\Program Files\MATLAB\R2016a\toolbox\local\pathdef.m


If you look inside this file, at the end you can see userpath. This parameter stores the path to your workspace, for instance:

C:\Users\UserName\Documents\MATLAB;


## How to add a path to the search path temporarily?

To do this you can add each folder using the command addpath
This command will add the path to the search list and as soon as you close MATLAB it will be removed from the list.

addpath('/img/new/folders');


## How to add a path to the search path permanently?

You can use savepath command to save the path to the pathdef.m file. This change would be permanently and would not be removed from the search list even if you exit MATLAB.

savepath(c:\Program Files\MyToolbox);


## How to #interpolate using #splines: A simple #MATLAB #tutorial for beginners

In this video I will show how you can use curve fitting functions provided by MATLAB to interpolate data.
First, I make some datapoints and plot them. Then I use the function ‘spapi’ (spline interpolation) only with 2 knots to make linear piece-wise interpolation. The I use ‘csapi’ to make a smooth and precise interpolation. Then I will show by using ‘csape’ with end condition we can get better results.

## #Optimization with #Simulated #Annealing – A #MATLAB tutorial for beginners

In this tutorial I will show how to use Simulated Annealing for minimizing the Booth’s test function. Simulated Annealing is one of the most famous optimization algorithms that has been also implemented in MATLAB as a built-in function. The Booth’s test function is a famous test function for evaluating single objective optimization algorithms. It has two inputs ans one output. It is also bounded in range [-10 10] and the minimum is at [1 3]. By knowing the minimum point we can test the algorithm.

In this tutorial, I show implementation of the Booth’s single-objective test problem and optimize it using the built-in Simulated Annealing in MATLAB. The given objective function is a standard test function that helps a beginner user to understand the basic concept of optimization in MATLAB easier. The given objective function or fitness function has one vector input including ‘n=2’ variables and one output (objective values). I write two separate functions one for the fitness function and one for the main algorithm. I plot the best value function that illustrates the best value for the obtained solutions in a proper way. We use different setting of the algorithm using the ‘optimoptions’ function.

optimizing multi-objective ZDT1 test problem with 30 variables using Genetic Algorithm:

optimizing multi-objective ZDT1 test problem using Genetic Algorithm:

A simple optimization using Genetic Algorithm:

A simple constrained optimization using Genetic Algorithm:

A simple multi-objective optimization using Genetic Algorithm:

A mixed-integer optimization using Linear Programming:

A simple single-objective optimization using Particle Swarm Optimization Algorithm:

A simple single-objective optimization using Pattern Search:

## Particle Swarm Optimization – A MATLAB Tutorial for beginners

In this tutorial I will show you how to use the built-in Particle Swarm Optimization (PSO) algorithm in MATLAB. I optimize the famous Ackley’s function which has a global minimum at [0 0] and the function value in the optimum point is 0. I will also show you how to set new options for the algorithm such as number of particles or the swarm size. We add lower and upper boundaries to the problem and all the work is done in matlab scripts. I do not use optimization app.

Check other tutorials

Simple Genetic Algorithm in MATLAB: https://www.youtube.com/watch?v=zDj8cX8OAPY
Constrained Genetic Algorithm in MATLAB: https://www.youtube.com/watch?v=esGZtl3gIlY
Multi-objective Genetic Algorithm in MATLAB: https://www.youtube.com/watch?v=IV5Pr2E2cK4
Pattern Search algorithm in MATLAB: https://www.youtube.com/watch?v=GyaXXb9hb-M
Mixed-integer linear programming in MATLAB: https://www.youtube.com/watch?v=VdXyCnosOxI

## Using Multi-Objective Genetic Algorithm to Optimize the ZDT1 test problem – A MATLAB video tutorial

In this tutorial, I show implementation of the ZDT1 multi-objective test problem and optimize it using the built-in Multi-objective Genetic Algorithm in MATLAB. The given objective function is a standard test function that helps a beginner user to understand the basic concept of optimization in MATLAB easier. The given objective function or fitness function has one vector input including ‘n’ variables and two outputs (objective values). I write two separate functions one for the fitness function and one for the main algorithm. I plot the pareto-front that illustrates the obtained solutions in a proper way. We use different setting of the algorithm using the ‘optimoptions’ function.

For a simple tutorial on optimization using Genetic Algorithm with single objective functions without constraints see this post.

For a simple tutorial on optimization using Genetic Algorithm with single objective functions with constraints see this post.

For a tutorial on multi-objective optimization using Genetic Algorithm see this post.

for a tutorial on Mixed-integer optimization problem using linear programming see this post.

for a tutorial on Pattern Search optimization in MATLAB see this post.

## Optimization with Pattern Search – A MATLAB Tutorial for beginners

Pattern search is a local optimization technique that can be applied on both constrained and unconstrained optimization problems. The constraints can be either linear or nonlinear. The algorithm works based on an adaptive mesh which is aligned with the coordinate directions.

In this tutorial, I show implementation of an optimization problem and solving it using Pattern Search in MATLAB. The given objective function is a simple function that helps a beginner user to understand the basic concept of optimization in MATLAB easier. The given objective function or fitness function has two input variable and one output. In the second part of the tutorial I show how to write a prameterized form of the objective function. I write a simple script to model the problem and solving the optimization problem using the ‘patternsearch’ function from MATLAB.

For a simple tutorial on optimization using Genetic Algorithm with single objective functions without constraints see this post.

For a simple tutorial on optimization using Genetic Algorithm with single objective functions with constraints see this post.

For a tutorial on multi-objective optimization using Genetic Algorithm see this post.

for a tutorial on Mixed-integer optimization problem using linear programming see this post.

## Mixed-Integer Linear Programming – A MATLAB Tutorial for Beginners

In this tutorial, I show implementation of a mixed-integer optimization problem using linear programming in MATLAB. The given objective function is a simple function that helps a beginner user to understand the basic concept of optimization in MATLAB easier. The given objective function or fitness function has two input variable and one output. One of the input variables can be only an integer, while the second one is a real number. The problem is also subject to a set of inequalities. I write a simple script to model the problem and solving the optimization problem using the ‘intlinprog’ function from MATLAB.

For a simple tutorial on optimization using Genetic Algorithm with single objective functions without constraints see this post.

For a simpler tutorial on optimization using Genetic Algorithm with single objective functions with constraints see this post.

For a tutorial on multi-objective optimization using Genetic Algorithm see this post.