diff --git a/src/raster/r.fuzzy.set/fuzzy.c b/src/raster/r.fuzzy.set/fuzzy.c index 6a37243014..50c7f7e6a5 100644 --- a/src/raster/r.fuzzy.set/fuzzy.c +++ b/src/raster/r.fuzzy.set/fuzzy.c @@ -1,5 +1,6 @@ #include #include "local_proto.h" +#include float fuzzy(FCELL cell) { @@ -42,8 +43,8 @@ float fuzzy(FCELL cell) } if (type == SSHAPE) { - m = pow(2, exp(2 * abs(shape))); - return (shape < 0) ? pow(1 - cos(x * PI2), m) : pow(sin(x * PI2), m); + m = pow(2, exp(2 * fabs(shape))); + return (shape < 0) ? 1 - pow(cos(x * PI2), m) : pow(sin(x * PI2), m); } return -1; /* error */ diff --git a/src/raster/r.fuzzy.set/r.fuzzy.set.html b/src/raster/r.fuzzy.set/r.fuzzy.set.html index 51067303ec..f2e554c533 100644 --- a/src/raster/r.fuzzy.set/r.fuzzy.set.html +++ b/src/raster/r.fuzzy.set/r.fuzzy.set.html @@ -75,7 +75,7 @@

Calculation of boundary shape

Depending on type of the boundary different equation are used to determine its shape:

-Linear: the membership is calculated according following equation:
+Linear: the membership is calculated according following equation:


 value  <=  A -> x = 0
 A < value > B -> x = (value-A)/(B-A)
@@ -87,33 +87,38 @@ 

Calculation of boundary shape

-S-shaped: it use following equation: +S-shaped: the membership is calculated according following equation:


 sin(x * Pi/2)^m (for positive shape parameter)
 1-cos(x * Pi/2)^m (for negative shape parameter)
 
 where x: membership, and
-m = 2^exp(2,shape) (for positive shape parameter)
-m = 2^(1+shape) (for negative shape parameter)
-where m: shape parameter.
+m = 2^exp(2 * |shape|) 
+For default shape=0, m = 2 (most common parameter for that equation).
 
-For default shape parameter = 0 m is = 2 which is most common parameter for -that equation. +

+G-shaped: the membership is calculated according following equation: +


+tan(x * Pi/4)^1/m
+
+where x: membership, and
+m = 2^exp(-2 * shape) (for negative shape parameter)
+m = 2^(1-shape) (for positive shape parameter)
+For default shape=0, m = 2 (most common parameter for that equation).
+

-G-shaped and J shaped: it use following equations: +J shaped: it use following equations:


-tan(x * Pi/4)^m (for J-shaped)
-tan(x * Pi/4)^1/m (for G-shaped)
+tan(x * Pi/4)^m
 
 where x: membership, and
-m = 2^exp(2,shape) (for positive shape parameter)
+m = 2^exp(2 * shape) (for positive shape parameter)
 m = 2^(1+shape) (for negative shape parameter)
-where m: shape parameter.
+For default shape=0, m = 2 (most common parameter for that equation).
 
-

SEE ALSO

@@ -130,7 +135,7 @@

REFERENCES

Computers & Geosciences (37) 1525-1531. DOI https://doi.org/10.1016/j.cageo.2010.09.008
  • Zadeh, L.A. (1965). "Fuzzy sets". Information and Control 8 (3): 338–353. -. +https://doi.org/10.1016/S0019-9958(65)90241-X.
  • Novák, Vilém (1989). Fuzzy Sets and Their Applications. Bristol: Adam Hilger. ISBN 0-85274-583-4.