Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Membership Function Gallery

This example shows how to display 11 membership functions supported in the Fuzzy Logic Toolbox™.

Define membership function names and parameters.

mf_type = {'trapmf','gbellmf','trimf','gaussmf','gauss2mf','smf',...
    'zmf','psigmf','dsigmf','pimf','sigmf'};
param = [-19 -17 -12 -7;
    3 4 -8 0;
    -9 -1 2 0;
    3 5 0 0;
    3 10 5 13;
    11  17   0  0;
    -18 -10   0  0;
    2 -11 -5 -4;
    5 -3 1 5;
    0 7 11 15;
    2 15 0 0];

For more information on the different membership functions and their parameters, see their respective function reference pages.

Evaluate the membership functions.

x = linspace(-20,20,201);
mf = evalmmf(x, param, char(mf_type));

Plot the evaluated membership functions with labels.

subplot(2,1,1);
plot(x,mf(1:6,:)');
axis([min(x) max(x) 0 1.2]);
text((param(1,2)+param(1,3))/2,1.1,mf_type{1},...
    'horizon','center');
text(param(2,3),1.1,mf_type{2},...
    'horizon','center');
text(param(3,2),1.1,mf_type{3},...
    'horizon','center');
text(param(4,2),1.1,mf_type{4},...
    'horizon','center');
text((param(5,2)+param(5,4))/2,1.1,mf_type{5},...
    'horizon','center');
text(param(6,2), 1.1,mf_type{6},...
    'horizon','center');
h_gca = gca;
h_gca.XTick = [];

subplot(2,1,2);
plot(x,mf(7:11,:)');
axis([min(x) max(x) 0 1.2]);
text(param(7,1),1.1,mf_type{7},...
    'horizon','center');
text((param(8,2)+param(8,4))/2,1.1,mf_type{8},...
    'horizon','center');
text((param(9,2)+param(9,4))/2,1.1,mf_type{9},...
    'horizon','center');
text((param(10,2)+param(10,3))/2,1.1,mf_type{10},...
    'horizon','center');
text(param(11,2),1.1,mf_type{11},...
    'horizon','center');
h_gca =  gca;
h_gca.XTick = [];

Was this topic helpful?