PSIGMF
Generates the product of two sigmoid membership functions. The shape of the curve is defined by multiplying two sigmoids together.
The equation is defined as y = f1(x) * f2(x) where f1 and f2 are sigmoid functions defined by parameters b1, c1 and b2, c2. For a smoothed rect-like function, choose c2 < 0 < c1. For its inverse, choose c1 < 0 < c2.
Excel Usage
=PSIGMF(x, b_one, c_one, b_two, c_two)
x(list[list], required): Array of independent universe variables.b_one(float, required): Center bias for the first sigmoid.c_one(float, required): Controls width of the first sigmoidal region.b_two(float, required): Center bias for the second sigmoid.c_two(float, required): Controls width of the second sigmoidal region.
Returns (list[list]): Array of membership values corresponding to the input universe.
Example 1: Product of sigmoids forming a smooth window
Inputs:
| x | b_one | c_one | b_two | c_two | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 2 | 2 | 5 | -2 |
Excel formula:
=PSIGMF({0,1,2,3,4,5,6,7}, 2, 2, 5, -2)
Expected output:
| Result |
|---|
| 0.0179854 |
| 0.119163 |
| 0.498764 |
| 0.864955 |
| 0.864955 |
| 0.498764 |
| 0.119163 |
| 0.0179854 |
Example 2: Product of sigmoids forming an inverse window
Inputs:
| x | b_one | c_one | b_two | c_two | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 2 | -2 | 5 | 2 |
Excel formula:
=PSIGMF({0,1,2,3,4,5,6,7}, 2, -2, 5, 2)
Expected output:
| Result |
|---|
| 0.0000445813 |
| 0.000295375 |
| 0.00123631 |
| 0.00214401 |
| 0.00214401 |
| 0.00123631 |
| 0.000295375 |
| 0.0000445813 |
Example 3: Product of sigmoids at a scalar midpoint
Inputs:
| x | b_one | c_one | b_two | c_two |
|---|---|---|---|---|
| 3.5 | 2 | 2 | 5 | -2 |
Excel formula:
=PSIGMF(3.5, 2, 2, 5, -2)
Expected output:
0.907397
Example 4: Product of sigmoids shifted into a negative domain
Inputs:
| x | b_one | c_one | b_two | c_two | |||||
|---|---|---|---|---|---|---|---|---|---|
| -4 | -3 | -2 | -1 | 0 | 1 | -3 | 1.5 | 0 | -1.5 |
Excel formula:
=PSIGMF({-4,-3,-2,-1,0,1}, -3, 1.5, 0, -1.5)
Expected output:
| Result |
|---|
| 0.181974 |
| 0.494507 |
| 0.7788 |
| 0.7788 |
| 0.494507 |
| 0.181974 |
Python Code
Show Code
import numpy as np
from skfuzzy import psigmf as fuzz_psigmf
def psigmf(x, b_one, c_one, b_two, c_two):
"""
Generate the product of two sigmoid membership functions.
See: https://pythonhosted.org/scikit-fuzzy/api/skfuzzy.html#skfuzzy.psigmf
This example function is provided as-is without any representation of accuracy.
Args:
x (list[list]): Array of independent universe variables.
b_one (float): Center bias for the first sigmoid.
c_one (float): Controls width of the first sigmoidal region.
b_two (float): Center bias for the second sigmoid.
c_two (float): Controls width of the second sigmoidal region.
Returns:
list[list]: Array of membership values corresponding to the input universe.
"""
try:
def to1d(arr):
if isinstance(arr, list):
flat = []
for row in arr:
row_list = row if isinstance(row, list) else [row]
for val in row_list:
try:
flat.append(float(val))
except (TypeError, ValueError):
continue
return np.array(flat)
return np.array([float(arr)])
x_arr = to1d(x)
if len(x_arr) == 0:
return "Error: Input mapping array x cannot be empty"
result = fuzz_psigmf(x_arr, b_one, c_one, b_two, c_two)
return [[float(val)] for val in result]
except Exception as e:
return f"Error: {str(e)}"Online Calculator
Array of independent universe variables.
Center bias for the first sigmoid.
Controls width of the first sigmoidal region.
Center bias for the second sigmoid.
Controls width of the second sigmoidal region.