View source: R/PlotZFunction.R
PlotZFunction | R Documentation |
PlotZFunction
applies the selected function to a fuzzy number using the Zadeh's principle, and plots
the input and output.
PlotZFunction(
value,
FUN,
knots = 10,
grid = TRUE,
alternate = FALSE,
approximation = FALSE,
method = "NearestEuclidean",
...
)
value |
Input fuzzy number. |
FUN |
Function used for the input fuzzy number with the help of the Zadeh's principle. |
knots |
Number of the alpha-cuts used during calculation of the output. |
grid |
If |
alternate |
If |
approximation |
If |
method |
The selected approximation method. |
... |
Additional parameters passed to other functions. |
The function takes the input fuzzy number value
(which should be described by one of the
classes from FuzzyNumbers
package) and applies the function FUN
using
the Zadeh's principle. The output is given by a fuzzy number or its approximation (when
approximation
is set to TRUE
and the respective method
is selected).
To properly find the output, value of FUN
is calculated for many alpha-cuts of value
.
The number of these alpha-cuts is equal to knots
(plus 2 for the support and the core).
The input and output fuzzy numbers are plotted together with the applied function.
If the approximation is used, then also the approximated fuzzy number is shown (green line).
The input fuzzy number value
should be given by fuzzy number described by classes from FuzzyNumbers
package.
Three (or four) figures are plotted: the input fuzzy number, the respective output (for the Zadeh's principle and the applied function), and the function. The output fuzzy number can be approximated with the selected method and also plotted.
library(FuzzyNumbers)
# prepare complex fuzzy number
A <- FuzzyNumber(-5, 3, 6, 20, left=function(x)
pbeta(x,0.4,3),
right=function(x) 1-x^(1/4),
lower=function(alpha) qbeta(alpha,0.4,3),
upper=function(alpha) (1-alpha)^4)
# plot the figures
PlotZFunction(A,FUN=function(x)x^3+2*x^2-1)
# find and plot the approximated output via the Zadeh's principle
PlotZFunction(A,FUN=function(x)x^3+2*x^2-1,approximation=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.