Octave Fuzzy Logic Toolkit: smf

### Function Reference: `smf`

Function File: y = smf (x, params)
Function File: y = smf ([x1 x2 ... xn], [a b])

For a given domain x and parameters params (or [a b]), return the corresponding y values for the S-shaped membership function.

The argument x must be a real number or a non-empty vector of strictly increasing real numbers, and a and b must be real numbers, with a < b. This membership function satisfies:

               0                                if x <= a
       f(x) =  2 * ((x - a)/(b - a))^2          if a < x <= (a + b)/2
               1 - 2 * ((x - b)/(b - a))^2      if (a + b)/2 < x < b
               1                                if x >= b

which always returns values in the range [0, 1].

To run the demonstration code, type "`demo smf`" (without the quotation marks) at the Octave prompt.

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

### Example: 1

     x = 0:100;
     params = [40 60];
     y1 = smf(x, params);
     params = [25 75];
     y2 = smf(x, params);
     params = [10 90];
     y3 = smf(x, params);
     figure('NumberTitle', 'off', 'Name', 'smf demo');
     plot(x, y1, 'r;params = [40 60];', 'LineWidth', 2)
     hold on;
     plot(x, y2, 'b;params = [25 75];', 'LineWidth', 2)
     hold on;
     plot(x, y3, 'g;params = [10 90];', 'LineWidth', 2)
     ylim([-0.1 1.2]);
     xlabel('Crisp Input Value', 'FontWeight', 'bold');
     ylabel('Degree of Membership', 'FontWeight', 'bold');
     grid;