Fuzzy Logic

### Example 4: Natural Numbers

Problem. Suppose you are asked to define the set of natural numbers close to 6. There are a number of different ways in which you could accomplish this using fuzzy sets.

Solution 1. One solution would be to manually create a fuzzy set describing the numbers near 6. This can be done as follows:

Solution 2. A second solution would be to use the FuzzyTrapezoid function to create the fuzzy set. For a case such as this, a triangular fuzzy set would probably be better than a trapezoid, so we set the middle two parameters of the FuzzyTrapezoid function to 6.

Solution 3. Another solution would be to use a function to create a fuzzy set representing numbers near 6.

We can use this function to create a fuzzy set for numbers near 6.

Note that this is a convenient method because the function CloseTo can be called with any integer argument to produce a fuzzy set close to that number.

Solution 4. Still another solution is to use a piecewise function to describe the fuzzy set.

Now, we can view all four of our fuzzy representations of the number six to see how they compare. We do this by plotting them all on the same graph with the FuzzyPlot function.