Fuzzy Logic Tools v1.0
Public Member Functions | Protected Attributes
FLT::Membership Class Reference

This class contains methods and attributes common to all Membership functions. More...

#include <membership.hpp>

Inheritance diagram for FLT::Membership:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual double eval (double x) const =0
 Evaluates the Membership function.
virtual double evalder (double x) const =0
 Evaluates the derivative of the Membership function with respect to x, $ d\mu(x) / dx $.
virtual double paramder (size_t parameter, double x) const =0
 Evaluates the derivative of the Membership function with respect to a parameter, $ d\mu(x) / dparam $.
virtual int test (void) const
 This function checks parameters in the Membership function, and corrects them if possible.
size_t num_params (void) const
 Reads the number of parameters that define the Membership function.
TYPE_MF type (void) const
 Returns the type of Membership function.
int type (TYPE_MF type_mf)
 Changes the Membership function type.
int edit (size_t index, double value)
 Changes a parameter.
void edit (const double *const parameters)
 Changes the vector of parameters.
double read (size_t index) const
 Reads a parameter of the Membership function.
TNT::Array1D< double > read (void) const
 Returns the vector of parameters.
Membershipoperator= (const Membership &P)
 Membership (const Membership &P)

Protected Attributes

double * param
 Vector of parameters that define the Membership function.
size_t n
 Number of parameters of the Membership function.
TYPE_MF type_mf
 Type of Membership function.

Detailed Description

This class contains methods and attributes common to all Membership functions.

This class can store the type of Membership function and all its parameters and evaluates the function and its derivatives.

See also:
FLT::TYPE_MF for Membership functions details.
FLT::MF_NAMES for Membership functions names.
FLT::MF_PARAM_NUMBER for initial number of parameters.
For Template Numerical Toolkit (TNT) documentation see http://math.nist.gov/tnt
FLT::createMF virtual constructor.
Examples:

matlab_utilities/fuzderantec.cpp.


Member Function Documentation

int Membership::edit ( size_t  index,
double  value 
)

Changes a parameter.

Returns:
Returns 0 if no errors occurred.
An error means the index value is greater than the number of function parameters.
Note:
The parameter value is not checked. If you want to check it, you must use Membership::test method.
void Membership::edit ( const double *const  parameters)

Changes the vector of parameters.

Note:
The values of the parameters are not checked. If you want to check it, you must use Membership::test method.
virtual double FLT::Membership::eval ( double  x) const [pure virtual]

Evaluates the Membership function.

Remarks:
You must first ensure that the function is not Anymf.

Implemented in FLT::Anymf, FLT::Constmf, FLT::Gaussmf, FLT::Gauss2mf, FLT::GBellmf, FLT::Pimf, FLT::PSigmf, FLT::Smf, FLT::Sigmf, FLT::Sig2mf, FLT::Trapmf, FLT::Trimf, and FLT::Zmf.

virtual double FLT::Membership::evalder ( double  x) const [pure virtual]

Evaluates the derivative of the Membership function with respect to x, $ d\mu(x) / dx $.

Remarks:
You must first ensure that the function is not Anymf.

Implemented in FLT::Anymf, FLT::Constmf, FLT::Gaussmf, FLT::Gauss2mf, FLT::GBellmf, FLT::Pimf, FLT::PSigmf, FLT::Smf, FLT::Sigmf, FLT::Sig2mf, FLT::Trapmf, FLT::Trimf, and FLT::Zmf.

size_t Membership::num_params ( void  ) const

Reads the number of parameters that define the Membership function.

We recommend using this function instead of the constant FLT::MF_PARAM_NUMBER, since it is possible to create Membership functions with a variable number of parameters.

Examples:
matlab_utilities/fuzderantec.cpp.
virtual double FLT::Membership::paramder ( size_t  parameter,
double  x 
) const [pure virtual]

Evaluates the derivative of the Membership function with respect to a parameter, $ d\mu(x) / dparam $.

Remarks:
You must first ensure that the function is not Anymf.

Implemented in FLT::Anymf, FLT::Constmf, FLT::Gaussmf, FLT::Gauss2mf, FLT::GBellmf, FLT::Pimf, FLT::PSigmf, FLT::Smf, FLT::Sigmf, FLT::Sig2mf, FLT::Trapmf, FLT::Trimf, and FLT::Zmf.

double Membership::read ( size_t  index) const

Reads a parameter of the Membership function.

Returns:
If index is greater than the number of function parameters, an error is sent to the standard error stream and return 0.
int Membership::test ( void  ) const [virtual]

This function checks parameters in the Membership function, and corrects them if possible.

Returns:
Returns 0 if no errors, 1 if an error occurs, and -1 if the parameters were corrected.

Reimplemented in FLT::Gaussmf, FLT::Gauss2mf, FLT::GBellmf, FLT::Trapmf, and FLT::Trimf.

int Membership::type ( TYPE_MF  type_mf)

Changes the Membership function type.

Returns:
Returns 0 if no errors occurred.
An error means the type of Membership function is not recognized.
Note:
The parameters of the new Membership function are not assigned, you must do so by Membership::edit method.
TYPE_MF Membership::type ( void  ) const

Returns the type of Membership function.

The type of Membership function is represented with the enumeration FLT::TYPE_MF.

Examples:
matlab_utilities/fuzcomb.cpp, and matlab_utilities/fuzderantec.cpp.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines