Home > utility > bellmf.m

bellmf

PURPOSE ^

GBELLMF Generalized bell curve membership function.

SYNOPSIS ^

function y = gbellmf(x, params)

DESCRIPTION ^

GBELLMF Generalized bell curve membership function.
   GBELLMF(X, PARAMS) returns a matrix which is the generalized bell
   membership function evaluated at X. PARAMS is a 3-element vector
   that determines the shape and position of this membership function.
   Specifically, the formula for this membership function is:

   GBELLMF(X, [A, B, C]) = 1./((1+ABS((X-C)/A))^(2*B));

   Note that this membership function is an extension to the Cauchy
   probability dist. function. 
   
   For example:

       x = (0:0.1:10)';
       y1 = gbellmf(x, [1 2 5]);
       y2 = gbellmf(x, [2 4 5]);
       y3 = gbellmf(x, [3 6 5]);
       y4 = gbellmf(x, [4 8 5]);
       subplot(211); plot(x, [y1 y2 y3 y4]);
       y1 = gbellmf(x, [2 1 5]);
       y2 = gbellmf(x, [2 2 5]);
       y3 = gbellmf(x, [2 4 5]);
       y4 = gbellmf(x, [2 8 5]);
       subplot(212); plot(x, [y1 y2 y3 y4]);
       set(gcf, 'name', 'gbellmf', 'numbertitle', 'off');

   See also DSIGMF, EVALMF, GAUSS2MF, GAUSSMF, MF2MF, PIMF, PSIGMF, SIGMF, SMF,
   TRAPMF, TRIMF, ZMF.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function y = gbellmf(x, params)
0002 %GBELLMF Generalized bell curve membership function.
0003 %   GBELLMF(X, PARAMS) returns a matrix which is the generalized bell
0004 %   membership function evaluated at X. PARAMS is a 3-element vector
0005 %   that determines the shape and position of this membership function.
0006 %   Specifically, the formula for this membership function is:
0007 %
0008 %   GBELLMF(X, [A, B, C]) = 1./((1+ABS((X-C)/A))^(2*B));
0009 %
0010 %   Note that this membership function is an extension to the Cauchy
0011 %   probability dist. function.
0012 %
0013 %   For example:
0014 %
0015 %       x = (0:0.1:10)';
0016 %       y1 = gbellmf(x, [1 2 5]);
0017 %       y2 = gbellmf(x, [2 4 5]);
0018 %       y3 = gbellmf(x, [3 6 5]);
0019 %       y4 = gbellmf(x, [4 8 5]);
0020 %       subplot(211); plot(x, [y1 y2 y3 y4]);
0021 %       y1 = gbellmf(x, [2 1 5]);
0022 %       y2 = gbellmf(x, [2 2 5]);
0023 %       y3 = gbellmf(x, [2 4 5]);
0024 %       y4 = gbellmf(x, [2 8 5]);
0025 %       subplot(212); plot(x, [y1 y2 y3 y4]);
0026 %       set(gcf, 'name', 'gbellmf', 'numbertitle', 'off');
0027 %
0028 %   See also DSIGMF, EVALMF, GAUSS2MF, GAUSSMF, MF2MF, PIMF, PSIGMF, SIGMF, SMF,
0029 %   TRAPMF, TRIMF, ZMF.
0030 
0031 %   Roger Jang, 6-28-93, 10-5-93.
0032 %   Copyright 1994-2002 The MathWorks, Inc.
0033 %   $Revision: 1.22 $  $Date: 2002/04/14 22:20:41 $
0034 
0035 if nargin ~= 2
0036     error('Two arguments are required by the generalized bell MF.');
0037 elseif length(params) < 3
0038     error('Generalized bell MF needs at least three parameters.');
0039 elseif params(1) == 0,
0040     error('Illegal parameter in gbellmf() --> a == 0');
0041 end
0042 
0043 a = params(1); b = params(2); c = params(3);
0044 
0045 tmp = ((x - c)/a).^2;
0046 if (tmp == 0 & b == 0)
0047     y = 0.5;
0048 elseif (tmp == 0 & b < 0)
0049     y = 0;
0050 else
0051     tmp = tmp.^b;
0052     y = 1./(1 + tmp);
0053 end

Generated on Tue 01-Jun-2010 09:50:34 by m2html © 2003