# Membership functions

## DifferenceSigmoid membership function

FuzzyLogic.DifferenceSigmoidMFType
struct DifferenceSigmoidMF{T<:Real} <: FuzzyLogic.AbstractMembershipFunction

Difference of two sigmoids. See also SigmoidMF.

Fields

• a1::Real: slope of the first sigmoid.

• c1::Real: center of the first sigmoid.

• a2::Real: slope of the second sigmoid.

• c2::Real: center of the second sigmoid.

Example

mf = DifferenceSigmoidMF(5, 2, 5, 7)

## Gaussian membership function

FuzzyLogic.GaussianMFType
struct GaussianMF{T<:Real} <: FuzzyLogic.AbstractMembershipFunction

Gaussian membership function $e^{-\frac{(x-μ)²}{2σ²}}$.

Fields

• mu::Real: mean $μ$.

• sig::Real: standard deviation $σ$.

Example

mf = GaussianMF(5.0, 1.5)

## GeneralizedBell membership function

FuzzyLogic.GeneralizedBellMFType
struct GeneralizedBellMF{T<:Real, S<:Real} <: FuzzyLogic.AbstractMembershipFunction

Generalized Bell membership function $\frac{1}{1+\vert\frac{x-c}{a}\vert^{2b}}$.

Fields

• a::Real: Width of the curve, the bigger the wider.

• b::Real: Slope of the curve, the bigger the steeper.

• c::Real: Center of the curve.

Example

mf = GeneralizedBellMF(2, 4, 5)

## Linear membership function

FuzzyLogic.LinearMFType
struct LinearMF{T<:Real} <: FuzzyLogic.AbstractMembershipFunction

Linear membership function. If $a < b$, it is increasing (S-shaped), otherwise it is decreasing (Z-shaped).

Fields

• a::Real: foot.

• b::Real: shoulder.

Example

mf = LinearMF(2, 8)

## PiShape membership function

FuzzyLogic.PiShapeMFType
struct PiShapeMF{T<:Real} <: FuzzyLogic.AbstractMembershipFunction

Π-shaped membership function.

Fields

• a::Real: left foot.

• b::Real: left shoulder.

• c::Real: right shoulder.

• d::Real: right foot.

Example

mf = PiShapeMF(1, 4, 5, 10)

## PiecewiseLinear membership function

FuzzyLogic.PiecewiseLinearMFType
struct PiecewiseLinearMF{T<:Real, S<:Real} <: FuzzyLogic.AbstractMembershipFunction

Piecewise linear membership function.

Fields

• points::Array{Tuple{T, S}, 1} where {T<:Real, S<:Real}

Notes

If the input is between two points, its membership degree is computed by linear interpolation. If the input is before the first point, it has the same membership degree of the first point. If the input is after the last point, it has the same membership degree of the first point.

Example

mf = PiecewiseLinearMF([(1, 0), (2, 1), (3, 0), (4, 0.5), (5, 0), (6, 1)])

## ProductSigmoid membership function

FuzzyLogic.ProductSigmoidMFType
struct ProductSigmoidMF{T<:Real} <: FuzzyLogic.AbstractMembershipFunction

Product of two sigmoids. See also SigmoidMF.

Fields

• a1::Real: slope of the first sigmoid.

• c1::Real: center of the first sigmoid.

• a2::Real: slope of the second sigmoid.

• c2::Real: center of the second sigmoid.

Example

mf = ProductSigmoidMF(2, 3, -5, 8)

## SShape membership function

FuzzyLogic.SShapeMFType
struct SShapeMF{T<:Real} <: FuzzyLogic.AbstractMembershipFunction

S-shaped membership function.

Fields

• a::Real: foot.

• b::Real: shoulder.

Example

mf = SShapeMF(1, 8)

## Sigmoid membership function

FuzzyLogic.SigmoidMFType
struct SigmoidMF{T<:Real} <: FuzzyLogic.AbstractMembershipFunction

Sigmoid membership function $\frac{1}{1+e^{-a(x-c)}}$.

Fields

• a::Real: parameter controlling the slope of the curve.

• c::Real: center of the slope.

Example

mf = SigmoidMF(2, 5)

## Trapezoidal membership function

FuzzyLogic.TrapezoidalMFType
struct TrapezoidalMF{T<:Real} <: FuzzyLogic.AbstractMembershipFunction

Trapezoidal membership function.

Fields

• a::Real: left foot.

• b::Real: left shoulder.

• c::Real: right shoulder.

• d::Real: right foot.

Example

mf = TrapezoidalMF(1, 3, 7, 9)

## Triangular membership function

FuzzyLogic.TriangularMFType
struct TriangularMF{T<:Real} <: FuzzyLogic.AbstractMembershipFunction

Triangular membership function.

Fields

• a::Real: left foot.

• b::Real: peak.

• c::Real: right foot.

Example

mf = TriangularMF(3, 5, 7)

## Type2 membership function

FuzzyLogic.Type2MFType
struct Type2MF{MF1<:FuzzyLogic.AbstractMembershipFunction, MF2<:FuzzyLogic.AbstractMembershipFunction} <: FuzzyLogic.AbstractMembershipFunction

A type-2 membership function.

• lo::FuzzyLogic.AbstractMembershipFunction: lower membership function.

• hi::FuzzyLogic.AbstractMembershipFunction: upper membership function.

Example

mf = 0.7 * TriangularMF(3, 5, 7) .. TriangularMF(1, 5, 9)

## Weighted membership function

FuzzyLogic.WeightedMFType
struct WeightedMF{MF<:FuzzyLogic.AbstractMembershipFunction, T<:Real} <: FuzzyLogic.AbstractMembershipFunction

A membership function scaled by a parameter $0 ≤ w ≤ 1$.

• mf::FuzzyLogic.AbstractMembershipFunction: membership function.

• w::Real: scaling factor.

Example

mf = 0.5 * TriangularMF(1, 2, 3)

## ZShape membership function

FuzzyLogic.ZShapeMFType
struct ZShapeMF{T<:Real} <: FuzzyLogic.AbstractMembershipFunction

Z-shaped membership function.

Fields

• a::Real: shoulder.

• b::Real: foot.

Example

mf = ZShapeMF(3, 7)