MATLAB Functions
MATLAB Functions
Syntax
y = trimf(x,params)
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])
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])
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])
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');