Fuzzy Logic Products
-----
 /
Fuzzy Logic
*What's New in Version 2?
*Features
*Sample Images
*Contents
*Q&A
*Examples
*Classifying Houses
*Representing Age
*Finding the Disjunctive Sum
*Natural Numbers
*Fuzzy Hedges
<Distance Relation
*Choosing a Job
*Digital Fuzzy Sets
*Image Processing
*References
*Who's It For?
*Download Product
Manual
*Buy Online
*Technical FAQs
*Documentation
*For More Information
*Higher Education Solutions
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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.

DistMat = {{1, 0, 0.6}, {0.9, 0.7, 0.3}}

{{1, 0, 0.6`}, {0.9`, 0.7`, 0.3`}}

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.

DistRel = FromMembershipMatrix[DistMat, {{1, 2}, {1, 3}}]

FuzzyRelation[{{{1, 1}, 1}, {{1, 2}, 0}, {{1, 3}, 0.6`}, {{2,
1}, 0.9`}, {{2, 2}, 0.7`}, {{2, 3}, 0.3`}}, UniversalSpace -> {{1, 2, 1}, {1, 3, 1}}]

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.

FuzzyPlot3D[DistRel, AxesLabel -> {" X",
"Y", "Grade  "}, ViewPoint -> {2, 0, 1}, AxesEdge -> {{-1, -1}, {1, -1}, {1,
1}}] ;

[Graphics:HTMLFiles/distance_6.gif]

ToMembershipMatrix[DistRel] // MatrixForm

( 1      0      0.6` )    0.9`   0.7`   0.3`

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

Any questions about topics on this page? Click here to get an individual response.