Function File: y = gauss2mf (x, params)
Function File: y = gauss2mf ([x1 x2 ... xn], [sig1 c1 sig2 c2])

For a given domain x and parameters params (or [sig1 c1 sig2 c2]), return the corresponding y values for the two-sided Gaussian composite membership function. This membership function is a smooth curve calculated from two Gaussian membership functions as follows:

Given parameters sig1, c1, sig2, and c2, that define two Gaussian membership functions, let:

f1(x) = exp((-(x - c1)^2)/(2 * sig1^2))     if x <= c1
        1                                   otherwise

f2(x) = 1                                   if x <= c2
        exp((-(x - c2)^2)/(2 * sig2^2))     otherwise

Then gauss2mf is given by:

f(x) = f1(x) * f2(x)

The argument x must be a real number or a non-empty vector of strictly increasing real numbers, and sig1, c1, sig2, and c2 must be real numbers. Gauss2mf always returns a continuously differentiable curve with values in the range [0, 1].

If c1 < c2, gauss2mf is a normal membership function (has a maximum value of 1), with the rising curve identical to that of f1(x) and a falling curve identical to that of f2(x), above. If c1 >= c2, gauss2mf returns a subnormal membership function (has a maximum value less than 1).

To run the demonstration code, type demo('gauss2mf') at the Octave prompt.

See also: dsigmf, gaussmf, gbellmf, pimf, psigmf, sigmf, smf, trapmf, trimf, zmf.

Demonstration 1

The following code

 x = -10:0.2:10;
 params = [3 0 1.5 2];
 y1 = gauss2mf(x, params);
 params = [1.5 0 3 2];
 y2 = gauss2mf(x, params);
 params = [1.5 2 3 0];
 y3 = gauss2mf(x, params);
 figure('NumberTitle', 'off', 'Name', 'gauss2mf demo');
 plot(x, y1, 'r;params = [3 0 1.5 2];', 'LineWidth', 2);
 hold on ;
 plot(x, y2, 'b;params = [1.5 0 3 2];', 'LineWidth', 2);
 hold on ;
 plot(x, y3, 'g;params = [1.5 2 3 0];', 'LineWidth', 2);
 ylim([-0.1 1.1]);
 xlabel('Crisp Input Value', 'FontWeight', 'bold');
 ylabel('Degree of Membership', 'FontWeight', 'bold');
 grid;
 hold;

Produces the following figure

Figure 1

Package: fuzzy-logic-toolkit