fuzzylite  6.0
A Fuzzy Logic Control Library in C++
fl::Cosine Class Reference

The Cosine class is an extended Term that represents the cosine membership function. More...

#include <Cosine.h>

Inheritance diagram for fl::Cosine:
Collaboration diagram for fl::Cosine:

Public Member Functions

 Cosine (const std::string &name="", scalar center=fl::nan, scalar width=fl::nan, scalar height=1.0)
 
virtual ~Cosine () FL_IOVERRIDE
 
virtual std::string className () const FL_IOVERRIDE
 Returns the name of the class of the term. More...
 
virtual std::string parameters () const FL_IOVERRIDE
 Returns the parameters of the term. More...
 
virtual void configure (const std::string &parameters) FL_IOVERRIDE
 Configures the term with the parameters. More...
 
virtual Complexity complexity () const FL_IOVERRIDE
 Computes the estimated complexity of evaluating the membership function. More...
 
virtual scalar membership (scalar x) const FL_IOVERRIDE
 Computes the membership function evaluated at \(x\). More...
 
virtual void setCenter (scalar center)
 Sets the center of the cosine. More...
 
virtual scalar getCenter () const
 Gets the center of the cosine. More...
 
virtual void setWidth (scalar width)
 Sets the width of the cosine. More...
 
virtual scalar getWidth () const
 Gets the width of the cosine. More...
 
virtual Cosineclone () const FL_IOVERRIDE
 Creates a clone of the term. More...
 
- Public Member Functions inherited from fl::Term
 Term (const std::string &name="", scalar height=1.0)
 
virtual ~Term ()
 
virtual void setName (const std::string &name)
 Sets the name of the term. More...
 
virtual std::string getName () const
 Gets the name of the term. More...
 
virtual void setHeight (scalar height)
 Sets the height of the term. More...
 
virtual scalar getHeight () const
 Gets the height of the term. More...
 
virtual std::string toString () const
 Returns the representation of the term in the FuzzyLite Language. More...
 
virtual void updateReference (const Engine *engine)
 Updates the references (if any) to point to the current engine (useful when cloning engines or creating terms within Importer objects. More...
 

Static Public Member Functions

static Termconstructor ()
 

Additional Inherited Members

- Protected Attributes inherited from fl::Term
scalar _height
 

Detailed Description

The Cosine class is an extended Term that represents the cosine membership function.

cosine.svg
Author
Juan Rada-Vilela, Ph.D.
See also
Term
Variable
Since
5.0

Definition at line 36 of file Cosine.h.

Constructor & Destructor Documentation

◆ Cosine()

fl::Cosine::Cosine ( const std::string &  name = "",
scalar  center = fl::nan,
scalar  width = fl::nan,
scalar  height = 1.0 
)
explicit

◆ ~Cosine()

virtual fl::Cosine::~Cosine ( )
virtual

Member Function Documentation

◆ className()

virtual std::string fl::Cosine::className ( ) const
virtual

Returns the name of the class of the term.

Returns
the name of the class of the term

Implements fl::Term.

◆ clone()

virtual Cosine* fl::Cosine::clone ( ) const
virtual

Creates a clone of the term.

Returns
a clone of the term

Implements fl::Term.

◆ complexity()

virtual Complexity fl::Cosine::complexity ( ) const
virtual

Computes the estimated complexity of evaluating the membership function.

Returns
the estimated complexity of evaluating the membership function

Implements fl::Term.

◆ configure()

virtual void fl::Cosine::configure ( const std::string &  parameters)
virtual

Configures the term with the parameters.

Parameters
parametersas "center width [height]"

Implements fl::Term.

◆ constructor()

static Term* fl::Cosine::constructor ( )
static

◆ getCenter()

virtual scalar fl::Cosine::getCenter ( ) const
virtual

Gets the center of the cosine.

Returns
the center of the cosine

◆ getWidth()

virtual scalar fl::Cosine::getWidth ( ) const
virtual

Gets the width of the cosine.

Returns
the width of the cosine

◆ membership()

virtual scalar fl::Cosine::membership ( scalar  x) const
virtual

Computes the membership function evaluated at \(x\).

Parameters
x
Returns
\(\begin{cases} 0h & \mbox{if $x < c - 0.5w \vee x > c + 0.5w$} \cr 0.5h \times ( 1 + \cos(2.0 / w\pi(x-c))) & \mbox{otherwise} \end{cases}\)

where \(h\) is the height of the Term, \(c\) is the center of the Cosine, \(w\) is the width of the Cosine

Implements fl::Term.

◆ parameters()

virtual std::string fl::Cosine::parameters ( ) const
virtual

Returns the parameters of the term.

Returns
"center width [height]"

Implements fl::Term.

◆ setCenter()

virtual void fl::Cosine::setCenter ( scalar  center)
virtual

Sets the center of the cosine.

Parameters
centeris the center of the cosine

◆ setWidth()

virtual void fl::Cosine::setWidth ( scalar  width)
virtual

Sets the width of the cosine.

Parameters
widthis the width of the cosine

The documentation for this class was generated from the following file: