0% found this document useful (0 votes)
43 views

MATLAB Functions

This document describes 5 common membership functions and defuzzification methods used in fuzzy logic systems: 1) triangular, 2) trapezoidal, 3) Gaussian membership functions which define the degree of membership for input values, and 4) centroid and 5) maximum membership (MOM, LOM, FOM) defuzzification methods which provide a crisp output from the fuzzy inference process. Examples of each are provided using MATLAB syntax.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

MATLAB Functions

This document describes 5 common membership functions and defuzzification methods used in fuzzy logic systems: 1) triangular, 2) trapezoidal, 3) Gaussian membership functions which define the degree of membership for input values, and 4) centroid and 5) maximum membership (MOM, LOM, FOM) defuzzification methods which provide a crisp output from the fuzzy inference process. Examples of each are provided using MATLAB syntax.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MATLAB functions:

1. Triangular membership function:-


This is one of the most widely accepted and used membership function (MF) in fuzzy
controller design. The triangle which fuzzifies the input can be defined by three parameters
a, b and c, where and c defines the base and b defines the height of the triangle.

Syntax
y = trimf(x,params)

y = trimf(x,params) returns fuzzy membership values computed using the following


triangular
membership function:

Eg:
x = 0:0.1:10;
y = trimf(x,[3 6 8]);
plot(x,y)
title('trimf, P = [3 6 8]')
xlabel('x')
ylabel('Degree of Membership')
ylim([-0.05 1.05])

2. Trapezoidal membership function:-

Syntax
y = trapmf(x,params)
This function computes fuzzy membership values using a trapezoidal membership function.
You can also compute this membership function using a fismf object. For more information,
see fismf Object. This membership function is related to the trimf, linsmf, and linzmf
membership functions.

y = trapmf(x,params)
returns fuzzy membership values computed using the following trapezoidal membership
function:

Eg:
x = 0:0.1:10;
y = trapmf(x,[1 5 7 8]);
plot(x,y)
title('trapmf, P = [1 5 7 8]')
xlabel('x')
ylabel('Degree of Membership')
ylim([-0.05 1.05])

3. Gaussian membership function:-


The Gaussian MF block implements a membership function based on a symmetric Gaussian
function.

Here, c is the mean and σ is the standard deviation of the Gaussian function.
A Gaussian membership function is not the same as a Gaussian probability distribution. For
example, a Gaussian membership function always has a maximum value of 1.
Eg:
x = 0:0.1:10;
y = gaussmf(x,[2 5]);

plot(x,y)
xlabel('gaussmf, P=[2 5]')
ylabel('Membership')
ylim([-0.05 1.05])

4. Centroid defuzzification function:-


Centroid defuzzification returns the centre of gravity of the fuzzy set along the x-axis. If you
think of the area as a plate with uniform thickness and density, the centroid is the point
along the x-axis about which the fuzzy set would balance. The centroid is computed using
the following formula, where μ(xi) is the membership value for point xi in the universe of
discourse.

Syntax:- xCentroid = defuzz(x,mf,'centroid');

Eg:
x = 0:0.1:20;
mf1 = trapmf(x,[0 2 8 12]);
mf2 = trapmf(x,[5 7 12 14]);
mf3 = trapmf(x,[12 13 18 19]);
mf = max(0.5*mf2,max(0.9*mf1,0.1*mf3));
plot(x,y)
xCentroid = defuzz(x,mf,'centroid');
hCentroid = line([xCentroid xCentroid],[-0.2 1.2],'Color','k');
5. Maximum membership (MOM, LOM, FOM) function:-
MOM, FOM, and LOM stand for middle, smallest, and largest of maximum, respectively. In
this example, since the aggregate fuzzy set has a plateau at its maximum value, the MOM,
FOM, and LOM defuzzification results have distinct values. If the aggregate fuzzy set has a
unique maximum, then MOM, FOM, and LOM all produce the same value.

MOM:
LOM:

FOM:

Eg:
x = 0:0.1:20;
mf1 = trapmf(x,[0 2 8 12]);
mf2 = trapmf(x,[5 7 12 14]);
mf3 = trapmf(x,[12 13 18 19]);
mf = max(0.5*mf2,max(0.9*mf1,0.1*mf3));
plot(x,y)
xMOM = defuzz(x,mf,'mom');
xSOM = defuzz(x,mf,'som');
xLOM = defuzz(x,mf,'lom');

You might also like