Learn R Programming

ZEP (version 0.3.1)

PlotZEP: Plot input and output for the Zadeh's principle

Description

PlotZEP applies the selected function to a fuzzy number using the Zadeh's principle, and plots the input and output.

Usage

PlotZEP(
  value,
  FUN,
  knots = 10,
  grid = TRUE,
  alternate = FALSE,
  approximation = FALSE,
  xRange = NA,
  yRange = NA,
  method = "NearestEuclidean",
  ...
)

Value

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.

Arguments

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 TRUE, then additional grid is plotted.

alternate

If TRUE, the second type of the layout of figures is used.

approximation

If TRUE, the approximated output is calculated.

xRange

If NA, the support of the input fuzzy number is used for to plot x-axis (first and second plot), otherwise the given vector is applied.

yRange

If NA, the support of the output fuzzy number (or its approximation) is used for to plot x-axis (third and fourth plot), otherwise the given vector is applied.

method

The selected approximation method.

...

Additional parameters passed to other functions.

Details

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.

Examples

Run this code

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

PlotZEP(A,FUN=function(x)x^3+2*x^2-1)

# find and plot the approximated output via the Zadeh's principle

PlotZEP(A,FUN=function(x)x^3+2*x^2-1,approximation=TRUE)


Run the code above in your browser using DataLab