Skip to content

Cosine

Cosine

Bases: Term

Extended term that represents the cosine membership function.

Equation

\(\mu(x) = \begin{cases} \dfrac{h}{2} \left(1 + \cos\left(\dfrac{2.0}{w}\pi(x-c)\right)\right) & \mbox{if } c - \dfrac{w}{2} \le x \le c + \dfrac{w}{2} \cr 0 & \mbox{otherwise} \end{cases}\)

where

  • \(h\): height of the Term
  • \(c\): center of the Cosine
  • \(w\): width of the Cosine

Attributes

center instance-attribute

center = center

width instance-attribute

width = width

Functions

__init__

__init__(name: str = '', center: float = nan, width: float = nan, height: float = 1.0) -> None

Constructor.

Parameters:

Name Type Description Default
name str

name of the Term

''
center float

center of the Cosine

nan
width float

width of the Cosine

nan
height float

height of the Term

1.0

configure

configure(parameters: str) -> None

Configure the term with the parameters.

Parameters:

Name Type Description Default
parameters str

center width [height].

required

membership

membership(x: Scalar) -> Scalar

Compute the membership function value of \(x\).

Parameters:

Name Type Description Default
x Scalar

scalar

required

Returns:

Type Description
Scalar

\(\mu(x) = \begin{cases} \dfrac{h}{2} \left(1 + \cos\left(\dfrac{2.0}{w}\pi(x-c)\right)\right) & \mbox{if } c - \dfrac{w}{2} \le x \le c + \dfrac{w}{2} \cr 0 & \mbox{otherwise} \end{cases}\)

parameters

parameters() -> str

Return the space-separated parameters of the term.

Returns:

Type Description
str

center width [height].