Learn R Programming

SAFD (version 0.4)

hukuhara: Hukuhara Difference

Description

Given two polygonal fuzzy numbers the functions calculates the Hukuhara difference Y-X if it exists. First the input data is tested for having the correct format using the function checking. If the Hukuhara difference exists and pic=1 then the input and the Hukuhara difference is plotted, otherwise no plot is produced.

Usage

hukuhara(X, Y, pic = 1)

Arguments

X
...polygonal fuzzy number (tested by checking)
Y
...polygonal fuzzy number (tested by checking)
pic
...numeric, if pic=1 then X, Y and Y-X (if existing) is plotted

Value

  • In case the input data is in the correct form and the Hukuhara difference exists, the Hukuhara difference is returned, in case not, NA is returned.

Details

See examples

See Also

See Also as checking, lrmodel

Examples

Run this code
#Example 1:
Y<-data.frame(x=c(0,0,0,1,2,2),alpha=c(0,0.5,1,1,0.5,0))
X<-data.frame(x=c(0,0,0,0,1.5,2),alpha=c(0,0.5,1,1,0.5,0))
Z<-data.frame(x=c(0,0,0,0.75,1.5,1.5),alpha=c(0,0.5,1,1,0.5,0))
h<-hukuhara(X,Y,1)
h
h<-hukuhara(Z,Y,1)
h

#Example 2:
Y<-data.frame(cbind(x=c(-2,-0.75,-0.25,0.5,1),alpha=c(0.3,0,1,0,0.3)))
X<-data.frame(cbind(x=c(-2,-0.75,-0.25,0.5,1),alpha=c(0,0.6,1,1,0)))
h<-hukuhara(X,Y)
h

#Example 3: in this case the hukuhara diff has to exist by construction
data(XX)
X<-translator(XX[[1]],50)
shift<-seq(-1,1,length=100)
Y<-X
Y$x<-X$x+shift
h<-hukuhara(X,Y,1)

#Example 4: in this case the hukuhara diff has to exist by construction
data(XX)
X<-translator(XX[[1]],5000)
shift<-seq(-1,1,length=10000)
Y<-X
Y$x<-X$x+shift
H<-hukuhara(X,Y,1)
H

Run the code above in your browser using DataLab