Main Content

fuzarith

Perform fuzzy arithmetic

Description

example

C = fuzarith(X,A,B,operator) returns the fuzzy set C, which is the result of applying the specified fuzzy operator to the fuzzy sets A and B. The operation is performed across the universe of discourse X

Examples

collapse all

Specify Gaussian and trapezoidal membership functions.

N = 501;
minX = -20;
maxX = 20;
x = linspace(minX,maxX,N);

A = trapmf(x,[-10 -2 1 3]);
B = gaussmf(x,[2 5]);

Evaluate the sum, difference, product, and quotient of A and B.

Csum = fuzarith(x,A,B,'sum');
Csub = fuzarith(x,A,B,'sub');
Cprod = fuzarith(x,A,B,'prod');
Cdiv = fuzarith(x,A,B,'div');

Plot the addition and subtraction results.

figure
subplot(2,1,1)
plot(x,A,'--',x,B,':',x,Csum,'c')
title('Fuzzy Addition, A+B')
legend('A','B','A+B')
subplot(2,1,2)
plot(x,A,'--',x,B,':',x,Csub,'c')
title('Fuzzy Subtraction, A-B')
legend('A','B','A-B')

Figure contains 2 axes objects. Axes object 1 with title Fuzzy Addition, A+B contains 3 objects of type line. These objects represent A, B, A+B. Axes object 2 with title Fuzzy Subtraction, A-B contains 3 objects of type line. These objects represent A, B, A-B.

Plot the multiplication and division results.

figure
subplot(2,1,1)
plot(x,A,'--',x,B,':',x,Cprod,'c')
title('Fuzzy Multiplication, A*B')
legend('A','B','A*B')
subplot(2,1,2)
plot(x,A,'--',x,B,':',x,Cdiv,'c')
title('Fuzzy Division, A/B')
legend('A','B','A/B')

Figure contains 2 axes objects. Axes object 1 with title Fuzzy Multiplication, A*B contains 3 objects of type line. These objects represent A, B, A*B. Axes object 2 with title Fuzzy Division, A/B contains 3 objects of type line. These objects represent A, B, A/B.

Input Arguments

collapse all

Universe of discourse, specified as a vector.

Input fuzzy set, specified as a vector with the same length as X. Each element of A is the value of the fuzzy set for the corresponding value of X.

A must be a convex fuzzy set. For more information, see Algorithms.

Input fuzzy set, specified as a vector with the same length as X. Each element of B is the value of the fuzzy set for the corresponding value of X.

B must be a convex fuzzy set. For more information, see Algorithms.

Arithmetic operator, specified as one of the following:

  • 'sum' — Fuzzy addition

  • 'sub' — Fuzzy subtraction

  • 'prod' — Fuzzy multiplication

  • 'div' — Fuzzy division

For more information on fuzzy arithmetic operations, see Algorithms.

Output Arguments

collapse all

Output fuzzy set, returned as a column vector with length equal to the length of X.

Algorithms

To perform fuzzy arithmetic operations, the fuzzy operands (input fuzzy sets A and B) must be convex fuzzy sets. A fuzzy set is convex if, for each pair of points x1 and x2 in the universe of discourse X and λ∈[0,1].

μ(λx1+(1λ)x2)min(μ(x1),μ(x2))

An α-cut of a fuzzy set is the region in the universe of discourse for which the fuzzy set has a specific membership value, α. For a convex fuzzy set, every α-cut defines a continuous region in the universe of discourse.

fuzarith uses the continuous regions defined by the α-cuts of fuzzy sets A and B to compute the corresponding α-cut of the output fuzzy set C. To do so, fuzarith uses interval arithmetic.

The following table shows how to compute the left and right boundaries of the output interval. Here:

  • [AL AR] is the interval defined by the α-cut of fuzzy set A.

  • [BL BR] is the interval defined by the α-cut of fuzzy set B.

  • [CL CR] is the interval defined by the α-cut of fuzzy set C.

Interval Arithmetic OperatorDefinition

Addition:

C = A+B

CL=AL+BLCR=AR+BR

Subtraction:

C = A-B

CL=ALBRCR=ARBL

Multiplication:

C = A*B

CL=min(ALBL,ALBR,ARBL,ARBR)CR=max(ALBL,ALBR,ARBL,ARBR)

Division:

C = A/B

CL=min(ALBL,ALBR,ARBL,ARBR)CR=max(ALBL,ALBR,ARBL,ARBR)

fuzarith removes invalid intervals for divisor B. Interval [BL,BR] is invalid if it includes zero.

Version History

Introduced before R2006a