fzn: Fuzzy Number

View source: R/fzn.R

fznR Documentation

Fuzzy Number

Description

This function creates an object of class fzn, which is a list containing the alpha-cuts of the membership function, the lower and upper limits of the corresponding alpha-cuts, and the interpolation method. This structure is not the fuzzy number itself because it does not contain the full membership function, but the values of some alpha-cuts, i.e. the values that the fuzzy number can take at some alpha-levels. The reason behind this methodology is that, in most applications, we are only interested in certain alpha-cuts and therefore it is not necessary to work with the full membership function.

Usage

fzn(alpha,
           l,
           u,
           interp = c("approx", "spline", "step", "step2"))

Arguments

alpha

A vector with the possibility values, a.k.a. alpha-cuts. It must start at 0 and end at 1, in ascending order. Alternatively, it can be a matrix of 3 rows in which the first row is the alpha-cuts vector, the second row is the corresponding lower limits vector and the third row is the corresponding upper limits vector.

l

A vector of the same length as alpha with the values of the lower limits of the corresponding alpha-cuts. If alpha is a matrix with 3 rows, l is ignored.

u

A vector of the same length as alpha with the values of the upper limits of the corresponding alpha-cuts. If alpha is a matrix with 3 rows, u is ignored.

interp

A string with the function or method used to interpolate new alpha-cuts. Choices are "approx" (default), "spline", "step" or "step2". For "approx", it is used the approx function with "linear" method. For "spline", it is used the spline function with "hyman" method (monotone cubic spline using Hyman filtering). For "step", it is used a step interpolation choosing the interval [l,u] as wide as possible. For "step2", it is used a step interpolation choosing the interval [l,u] as narrow as possible.

Value

An object of class fzn.

Examples

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 = "approx" by default
par(mfrow = c(2, 2))
plotfzn(x, main = "interp = \"approx\" (linear)")
x$interp <- "spline"
plotfzn(x, main = "interp = \"spline\"")
x$interp <- "step"
plotfzn(x, main = "interp = \"step\" (wide)", plot_points = TRUE)
x$interp <- "step2"
plotfzn(x, main = "interp = \"step2\" (narrow)", plot_points = TRUE)
x$interp <- "spline"
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.