Appendix B

MATLAB® Programs for Fuzzy Logic

B.1.1 Membership Functions

The Fuzzy Logic Toolbox provides a number of membership functions. The most widely used MFs are triangular, Gaussian, bell-shaped and trapezoidal. trimf(), trapmf(), gaussmf() and gbellmf() are built-in functions for triangular, trapezoidal, Gaussian and bell-shaped MFs. The general forms of use with parameters are described below:

y = trimf(x, [a b c])
y = trapmf(x, [a b c d ])
y = gaussmf(x, [a c]), 
y = gbellmf(x, [a b c])

Different parametric membership functions are discussed in Section 2.4 of Chapter 2. The triangular membership function trimf() depends on three parameters a, b and c. The parameters a, b and c locate the ‘feet’ of the triangle and the parameter c locates the peak. The trapezoidal function trapmf() depends on four scalar parameters a, b, c and d. The parameters a and d locate the ‘feet’ of the trapezoid and the parameters b and c locate the ‘shoulders’. The symmetric Gaussian membership function gaussmf() depends on two parameters a and c. The parameter c is the centre of the function and the width is determined by the parameter a of the Gaussian function. The generalized bell function gbellmf() depends on three parameters a, b and c. The parameter b is usually positive. The parameter c locates the centre and the parameter a determines the width of the membership function. Sample plots of these MFs are shown in Figure B.1.1.

Figure B.1.1 (a) Triangular MF = [3 6 8]; (b) Gaussian MF = ...

Get Computational Intelligence: Synergies of Fuzzy Logic, Neural Networks and Evolutionary Computing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.