plotfzn | R Documentation |
It plots a fuzzy number of class fzn
or a fuzzy array of
class fzarray
. The values at
each alpha-cut are joined by the corresponding interpolation method in order
to show how new alpha-cuts would be added.
plotfzn(x = NULL,
y = NULL,
alpha = NULL,
main = NULL,
xlab = "x",
ylab = "y",
col = "black",
plot_alpha = TRUE,
plot_points = FALSE)
x |
A fuzzy number of class |
y |
A fuzzy array of class |
alpha |
A numerical array with the alpha-cuts to be plotted, apart from 0 and 1. |
main |
Argument passed to function plot. |
xlab |
Argument passed to function plot. |
ylab |
Argument passed to function plot. |
col |
Argument passed to function plot. |
plot_alpha |
Logical. If |
plot_points |
Logical. If |
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")
par(mfrow = c(2, 2))
x <- seq(from = 0, to = 2 * pi, length.out = 101)
fzt <- fzn(alpha = c(0, 1), l = c(-0.5, 0), u = c(0.5, 0))
fzx1 <- x + fzt
fzy1 <- fuzzyfun(fzx1, fun = "^", y = 2)
fzx2 <- x + fzn(alphacut(fzt, alpha = c(0, 0.25, 0.5, 0.75, 1)))
fzy2 <- fuzzyfun(fzx2, fun = "^", y = 2)
fy1b <- fuzzyfun(fzx2, fun = "sin")
plotfzn(x = x, y = fzx1)
plotfzn(x = x, y = fzy1)
plotfzn(x = x, y = fzy2)
plotfzn(x = x, y = fy1b)
par(mfrow = c(1, 2))
fpol <- function(x) { return(0.2 * (-10 + 2* x + 6 * x^2 - x^3)) }
x <- seq(from = -2, t = 6, length.out = 101)
fzx1 <- x + fzt
plotfzn(x = x, y = fuzzyfun(x = fzx1, fun = "fpol"),
alpha = seq(from = 0, to = 1, by = 0.1))
fzx2 <- x + fzn(alphacut(fzt, alpha = seq(from = 0, to = 1, by = 0.1)))
plotfzn(x = x, y = fuzzyfun(x = fzx2, fun = "fpol"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.