Fuzzy Logic

### Example 6: Distance Relation

Problem. Let R be a fuzzy relation between the sets, X = {NYC, Paris} and Y = {Beijing, NYC, London}, that represents the idea of "very far." In list notation, the relation could be represented as follows [Klir& Folger, 1988].

R(X,Y) = 1.0/NYC, Beijing +   0/NYC, NYC + 0.6/NYC, London
+ 0.9/Paris, Beijing + 0.7/Paris, NYC + 0.3/Paris, London

Solution. We can represent this fuzzy relation in Mathematica in the following way. We can start by creating the membership matrix to represent the relation.

We need to represent the cities in each set with numbers. For set X, let NYC be 1, and Paris be 2; for set Y, let Beijing be 1, NYC be 2, and London be 3. Now we can create the relation using the FromMembershipMatrix function.

We can plot this relation using the FuzzyPlot3D function. We will use some of Mathematica's Plot3D options to put the graph in a form that lines up with the membership matrix so that you can see the correlation.

By customizing the graph, you can get it to match the membership matrix, which makes understanding the fuzzy relation easier.