alphacut: Alpha-cuts of a fuzzy number

View source: R/alphacut.R

alphacutR Documentation

Alpha-cuts of a fuzzy number

Description

This function gives the alpha-cuts of a fuzzy number x of class fzn or a fuzzy array of class fzarray, using the interpolation method given by the field "interp" of each fuzzy number.

Usage

alphacut(x,
                alpha)

Arguments

x

A fuzzy number of class fzn or a fuzzy array of class fzarray.

alpha

A numeric vector of numbers between 0 and 1 corresponding to the desired possibility values.

Value

If x is a fuzzy number, there are two possibilities: if length(alpha) == 1 it returns a vector of length 2 containing the range of the alpha-cut (lower value, upper value); otherwise it returns a matrix of size 3 x length(alpha). In this case, the 1st row is the alphas considered, while the 2nd and 3rd rows are the lower and upper values of the corresponding alpha-cut, respectively. If x is a fuzzy array, it returns a list with the outputs of each fuzzy number.

Examples

x <- fzn(alpha = c(0, 1), l = c(0, 1), u = c(2, 1))
par(mfrow = c(2, 2))
plotfzn(x, main = "Triangular x")
y <- fuzzyfun(fun = "sqrt", x)
plotfzn(y, main = "sqrt(x)")
x2 <- fzn(alphacut(x, alpha = seq( from = 0, to = 1, by = 0.1)))
plotfzn(x2, main = "x with extra alpha-cuts")
y2 <- fuzzyfun(fun = "sqrt", x2)
plotfzn(y2, main = "sqrt(x)")

x <- fzn(alpha = c(0, 0.1, 0.5, 0.8, 1),
         l = c(1, 3, 3, 4.5, 5),
         u = c(12, 10, 9, 6.5, 6),
         interp = "spline") # interp = "approx" by default
par(mfrow = c(1, 2))
plotfzn(x, main = "interp = spline")
# Adding new alpha-cuts using spline interpolation (since x$interp == "spline")
x <- fzn(alphacut(x, alpha = seq(from = 0, to = 1, by = 0.1)))
plotfzn(x, main = "interp = approx, with new alphacuts")


rbensua/fuzzyr documentation built on May 20, 2023, 7:11 a.m.