LRFN.plot: Plotting and drawing LR fuzzy numbers In Calculator.LR.FNs: Calculator for LR Fuzzy Numbers

Description

By this function one can plot and draw any kind of LR, RL and L fuzzy numbers.

Usage

 1 LRFN.plot(M, Left.fun = NULL, Right.fun = NULL, ... )

Arguments

 M A LR, RL or L fuzzy number Left.fun The left-shape function which usually defined before using LRFN.plot (see examples in bellow) Right.fun The right-shape function which usually defined before using LRFN.plot (see examples in bellow) ... Any argument of curve() function, such as xlim, ylim, lwd, lty, col, add and ... is acceptable for this function

Details

Befor useing "LRFN.plot" function, first define the left shape and the right shape functions of LR fuzzy number. Also, xlim argument must (is better to) be defined for the first fuzzy number.

Abbas Parchami

Examples

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 # Example 1: # First introduce left-side and right-side functions of LR fuzzy number Left.fun = function(x) { (1-x^2)*(x>=0)} Right.fun = function(x) { (exp(-x))*(x>=0)} A = LR(20, 12, 10) LRFN.plot(A, xlim=c(0,60), col=1) LRFN.plot(A, lty=2, lwd=3, col=2, add=TRUE) # Example 2: # for first LR fuzzy number: Left.fun = function(x) { (1-x^2)*(x>=0)} Right.fun = function(x) { (exp(-x))*(x>=0)} LRFN.plot( LR(17,5,3), xlim=c(5,40), lwd=2, lty=2, col=2) # for second LR fuzzy number: Left.fun = function(x) { (1/(1+x^2))*(x>=0)} Right.fun = function(x) { (1/(1+(2*abs(x))))*(x>=0)} LRFN.plot( RL(20,2,3), lwd=2, col=1, add=TRUE) # for third LR fuzzy number: Left.fun = function(x) { (1-x)*(x>=0)} LRFN.plot( L(30,15,5), lwd=2, lty=3, col=4, add=TRUE) legend( "topright", c("LR(17, 5, 3)", "RL(20, 2, 3)", "L(30, 15, 5)"), col = c(2, 1, 4) , text.col = 1, lwd = c(2,2,2), lty = c(2, 1, 3) ) ## The function is currently defined as function (M, Left.fun = NULL, Right.fun = NULL, ...) { if ( messages(M) != 1 ) { return( messages(M) ) } m = M m_l = M m_r = M x <- NULL if ( M == 0 ) { y = function(x) Left.fun((m-x)/m_l) * (x<=m) + Right.fun((x-m)/m_r) * (m

Example output  Attaching package: 'Calculator.LR.FNs'

The following object is masked from 'package:base':

sign

function (M, Left.fun = NULL, Right.fun = NULL, ...)
{
if (messages(M) != 1) {
return(messages(M))
}
m = M
m_l = M
m_r = M
x <- NULL
if (M == 0) {
y = function(x) Left.fun((m - x)/m_l) * (x <= m) + Right.fun((x -
m)/m_r) * (m < x)
}
else if (M == 1) {
y = function(x) Right.fun((m - x)/m_l) * (x <= m) + Left.fun((x -
m)/m_r) * (m < x)
}
else if (M == 0.5) {
y = function(x) Left.fun((m - x)/m_l) * (x <= m) + Left.fun((x -
m)/m_r) * (m < x)
}
else {
return(noquote(paste0("The fourth element of each LR fuzzy number must be 0 or 0.5 or 1!")))
}
return(curve(y(x) * (0 <= y(x) & y(x) <= 1), ...))
}

Calculator.LR.FNs documentation built on May 2, 2019, 8:25 a.m.