Perform fuzzy arithmetic
Perform Fuzzy Arithmetic
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
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')
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')
X — Universe of discourse
Universe of discourse, specified as a vector.
operator — Fuzzy arithmetic operator
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.
Fuzzy addition can generate the message
"divide by zero".
However, this warning does not affect the accuracy of
To perform fuzzy arithmetic operations, the fuzzy operands (input fuzzy sets
B) must be convex fuzzy
sets. A fuzzy set is convex if, for each pair of points
x2 in the universe of discourse
X and λ∈[0,1].
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
compute the corresponding α-cut of the output fuzzy set
C. To do so,
fuzarith uses interval
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 Operator||Definition|
|Addition: C = A+B||
|Subtraction: C = A-B||
|Multiplication: C = A*B||
|Division: C = A/B||