These functions create functions with a single argument x
that compute membership degrees of x
to a fuzzy set
of either triangular or raised-cosine shape that is defined by lo
, center
, and hi
.
triangular(lo, center, hi)raisedcosinal(lo, center, hi)
A lower bound (can be -Inf).
A peak value.
An upper bound (can be Inf).
A function with single argument x
that should be a numeric vector to be converted.
The arguments must satisfy lo <= center <= hi
. Functions compute membership degrees of triangular or
raised-cosine fuzzy sets. x
values equal to center obtain membership degree equal to 1,
xvalues lower than
loor greater than
hiobtain memberhsip degree equal to 0. A transition of the triangular (resp. raised cosinal) shape (with peak at
centeris computed for
xvalues between
loand
hi`.
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. NA
and NaN
values remain unchanged.
triangular()
produces fuzzy sets of a triangular shape (with peak at center
), raisedcosinal()
produces
fuzzy sets defined as a raised cosine hill.
# NOT RUN {
tr <- triangular(1, 2, 3)
tr(1:30 / 3)
rc <- raisedcosinal(1, 2, 3)
rc(1:30 / 3)
plot(triangular(-1, 0, 1), from=-2, to=3)
plot(triangular(-1, 0, 2), from=-2, to=3)
plot(triangular(-Inf, 0, 1), from=-2, to=3)
plot(triangular(-1, 0, Inf), from=-2, to=3)
plot(raisedcosinal(-1, 0, 1), from=-2, to=3)
plot(raisedcosinal(-1, 0, 2), from=-2, to=3)
plot(raisedcosinal(-Inf, 0, 1), from=-2, to=3)
plot(raisedcosinal(-1, 0, Inf), from=-2, to=3)
# }
Run the code above in your browser using DataLab