MATLAB® is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problem and solution are expressed in familiar mathematical notation. MATLAB is an interactive system whose basic data element is an array that does not require dimensioning.
The name MATLAB stands for matrix laboratory. The combination of analysis capabilities, flexibility, and power graphics makes MATLAB the premier software package for electrical engineers. It is the mainstay of the mathematical department software lineup and also available for PCs and Macintoshes. MATLAB was originally written to provide easy access to matrix software developed by the LINPACK and EISPACK projects.
Today MATLAB engines incorporate the LINPACK and Basic Linear Algebra Subprograms (BLAS) libraries, embedding the state-of-the-art software for matrix computation.
It is extremely powerful, simple to use, and can be found in most research and engineering environments. It gets more powerful and specialized with the addition of “toolboxes,” additional functions added to the MATLAB environment by various developers for specific tasks or fields. In this section, the MATLAB functions used in fuzzy algorithm, genetic algorithm (GA), particle swarm optimization (PSO), ant colony optimization, and hybrid genetic algorithm are listed and their definitions are provided.
• fuzzy—Basic fuzzy inference system (FIS) editor.
• mfedit—Membership function editor.
• ruleedit—Rule editor and parser.
• ruleview—Rule viewer and fuzzy inference diagram.
• Dsigmf—Difference of two-sigmoid membership functions.
• trapmf—Trapezoidal membership function.
• trimf—Triangular membership function.
• zmfZ—Shaped curve membership function.
• addmf—Add a membership function to an FIS.
• addrule—Add rule to FIS.
• addvar—Add variable to FIS.
• defuzz—Defuzzify membership function.
• newfis—Create new FIS.
• rmmf—Remove membership function from FIS.
• rmvar—Remove variable from FIS.
• setfis—Set fuzzy system properties
• showrule—Display FIS rules.
• writefis—Save FIS to disk.
• fuzblock—Simulink® fuzzy logic library.
• sffis—Fuzzy inference S-function for Simulink.
• ga—Implement the GA at the command line to minimize an objective function.
• gaoptimget—Get values of a GA options structure.
• gaoptimset—Create a GA options structure.
• gatool—Open the GA tool.
• population type (Population Type)—Specifies the data type of the input to the fitness function. Population type can be set to any one of the following:
• Double Vector (double Vector)—Use this option if the individuals in the population have type double.
• Bit string (bitstring)—Use this option if the individuals in the population are bit strings.
• Custom (custom)—Use this option to create a population whose data type is neither of the preceding.
• Creation function (CreationFcn)—Specifies the function that creates the initial population for GA.
• Mutation function (MutationFcn)—This option is used to specify Mutation function.
• Crossover function (CrossoverFcn)—Specifies the function that performs the crossover.
• Set options = gaoptimset(CreationFcn, @myfun);—Get values of a GA options structure function.
• Population = myfun(GenomeLength, FitnessFcn, options)—The input arguments to the function are
– Genomelength—Number of independent variables for the fitness function
– FitnessFcn—Fitness function
– options—Options structure
• The function returns Population, the initial population for the GA.
• Genomelength—Number of independent variables for the fitness function.
• FitnessFcn—Fitness function options.
• Options structure Off (off)—Only the final answer is displayed.
• Iterative (iter)—Information is displayed at each iteration.
• Diagnose (diagnose)—Information is displayed at each iteration. In addition, options that are changed from the defaults are listed.
• Final (final)—The outcome of the GA (successful or unsuccessful), the reason for stopping, and the final point.
• Hybrid Function Option—A hybrid function is another minimization function that runs after the GA terminates. Hybrid function is specified in Hybrid function (HybridFcn) options.
• fminsearch (@fminsearch)—Uses the MATLAB function fminsearch
• patternsearch (@patternsearch)—To find the minimum of a function using a pattern search.
• fminunc (@fminunc—Uses the Optimization Toolbox function fminunc.
• Generations (Generations)—Specifies the maximum number of iterations the GA will perform. The default is 100.
• Time limit (TimeLimit)—Specifies the maximum time in seconds the GA runs before stopping.
• Fitness limit (FitnessLimit)—The algorithm stops if the best fitness value is less than or equal to the value of Fitness limit.
• Stall generations (StallGenLimit)—The algorithm stops if there is no improvement in the best fitness value for the number of generations specified by Stall generations.
• Stall time (StallTimeLimit)—The algorithm stops if there is no improvement in the best fitness value for an interval of time in seconds specified by Stall time
• PSOparams—PSO parameters
• P(1)—Epochs between updating display, default = 100; if 0, no display.
• P(2)—Maximum number of iterations (epochs) to train, default = 2000.
• P(3)—Population size, default = 24.
• P(4)—Acceleration const 1 (local best influence), default = 2.
• P(5)—Acceleration const 2 (global best influence), default = 2.
• P(6)—Initial inertia weight, default = 0.9.
• P(7)—Final inertia weight, default = 0.4.
• P(8)—Epoch when inertial weight at final value, default = 1500.
• P(9)—Minimum global error gradient, if abs(Gbest(i+1)-Gbest(i)) < gradient over certain length of epochs, terminate run, default = 1e-25.
• P(10)—Epochs before error gradient criterion terminates run, default = 150, if the SSE does not change over 250 epochs then exit.
• P(11)—Error goal, if NaN then unconstrained min or max, default = NaN.
• P(12)—Type flag (which kind of PSO to use) 0 = Common PSO w/intertia (default) 1, 2 = Trelea types 1,2 3 = Clerc’s Constricted PSO, Type 1’
• P(13)—PSOseed, default = 0
= 0 for initial random positions
= 1 for initial particles as user input
Simulink is an interactive environment for modeling, analyzing, and simulating a wide variety of dynamic systems. It supports linear and nonlinear systems, modeled in continuous time, sampled time, or a hybrid of the two. Simulink provides a graphical user interface for constructing block diagram models using “drag and drop” operations. A system is configured in terms of block diagram representation from a library of standard components. A system block diagram representation is built easily, and the simulation results are displayed quickly. Simulation algorithms and parameters can be changed in the middle of a simulation with intuitive results, thus providing the user with a real world. Simulink is particularly useful for studying the effects of nonlinearities on the behavior of the system,
and as such it is also an ideal research tool. The key features of Simulink are as follows:
• Interactive simulations with live display.
• A comprehensive block library for creating linear, nonlinear, discrete, or hybrid multi-input/output systems.
• Seven integration methods for fixed steps and variable-step systems.
• Unlimited hierarchical model structure.
• Scalar and vector connections.
• Mask facility for creating custom blocks and block libraries.
Simulink provides an open architecture that allows extension of the simulation environment:
• The model parameters can be changed either interactively or in batch mode while simulation is running.
• Custom blocks and block libraries can be created with own icons and user interface from MATLAB, FORTRAN, or C code.
• C code from Simulink models can be generated for embedded applications and rapid prototyping of control systems.
• Hierarchical models can be created by grouping blocks into systems.
• Simulink provides immediate access to the mathematical, graphical, and programming capabilities of MATLAB.
• Analysis of data, automation procedures, and optimization of parameters can be done directly in Simulink.
• The advanced design and analysis capabilities of the tool boxes can be executed from within a simulation using the mask facility in Simulink.
• The Simulink block library can be executed with special purpose block sets.