Learn R Programming

ZEP (version 0.3.1)

AnimateZEP: Animate output for the Zadeh's principle

Description

AnimateZEP applies the selected function to a fuzzy number using the Zadeh's principle, and then animates the output.

Usage

AnimateZEP(
  value,
  FUN,
  knots = 10,
  approximation = FALSE,
  method = "NearestEuclidean",
  sleep = 0.05,
  ...
)

Value

One (or two) figures are animated: the output fuzzy number (for the Zadeh's principle and the applied function), and its approximation (if selected).

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.

approximation

If TRUE, the approximated output is calculated.

method

The selected approximation method.

sleep

Interval between frames in the animation.

...

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 output fuzzy number and its approximation are animated for the decreasing value of alpha (i.e., the consecutive alpha-cuts). If the approximation is used, then the approximated fuzzy number is shown with 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)

# animate the output fuzzy number

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

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

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



Run the code above in your browser using DataLab