Learn R Programming

lfl (version 1.4.2)

triangle: Compute membership degrees of values to the fuzzy set

Description

This function computes membership degrees of values to a fuzzy set that is defined on three numbers lo, center, and hi that form a triangle/raisedcos.

Usage

triangle(x, lo, center, hi)
raisedcos(x, lo, center, hi)

Arguments

x

Numeric vector of data to be converted.

lo

A lower bound (can be -Inf).

center

A peak value.

hi

An upper bound (can be Inf).

Value

A numeric vector of membership degrees.

Details

This function computes membership degrees of values to a fuzzy set that is defined on three numbers lo, center, and hi that form a triangle/raisedcos, i.e. value equal to center has a membership degree equal to 1, values lower than lo or greater than hi have memberhsip degree equal to 0. Between lo and hi, there is a transition of the triangular (resp. raised cosinal) shape (with peak at center).

If lo == -Inf then any value that is lower or equal to center gets memberhsip degree 1. Similarly, if hi == Inf then any value that is greater or equal to center gets memberhsip degree 1.

triangle produces fuzzy sets of a triangular shape (with peak at center), raisedcos produces fuzzy sets defined as a raised cosine hill.

See Also

fcut

Examples

Run this code
# NOT RUN {
plot(function(x) triangle(x, -1, 0, 1), from=-2, to=3)
plot(function(x) triangle(x, -1, 0, 2), from=-2, to=3)
plot(function(x) triangle(x, -Inf, 0, 1), from=-2, to=3)
plot(function(x) triangle(x, -1, 0, Inf), from=-2, to=3)

plot(function(x) raisedcos(x, -1, 0, 1), from=-2, to=3)
plot(function(x) raisedcos(x, -1, 0, 2), from=-2, to=3)
plot(function(x) raisedcos(x, -Inf, 0, 1), from=-2, to=3)
plot(function(x) raisedcos(x, -1, 0, Inf), from=-2, to=3)
# }

Run the code above in your browser using DataLab