WID3007 Fuzzy Logic Tutorial 1
WID3007 Fuzzy Logic Tutorial 1
Tutorial 1
Fuzziness and randomness are two different concepts in the realm of uncertainty and imprecision,
but there are some similarities and connections between them:
3. Statistical Approaches: Statistical methods are often used to analyze and describe both
fuzzy and random phenomena. In the case of randomness, statistics help describe the
probabilities of different outcomes. In fuzziness, techniques such as fuzzy logic and fuzzy
set theory use mathematical tools to handle and represent imprecise data.
5. Real-world Complexity: In many real-world scenarios, both fuzziness and randomness may
coexist. For example, in financial markets, stock prices can exhibit both random
fluctuations and fuzzy trends due to imprecise economic indicators and investor sentiment.
Despite these similarities, it's important to distinguish between the two. Fuzziness deals with
imprecision within well-defined categories or concepts, while randomness pertains to the inherent
unpredictability of outcomes or events.
Imagine you are the manager of a restaurant, and you want to assess the level of customer
satisfaction with the service provided. You ask your customers to rate their satisfaction on a scale
from 1 to 10, with 1 being "extremely dissatisfied" and 10 being "extremely satisfied." However,
customer satisfaction is a subjective and qualitative concept, and people may have different
interpretations of what "satisfaction" means.
In this scenario:
Fuzziness of Satisfaction: Different customers might have different expectations and experiences,
and their perceptions of satisfaction can vary. What one customer considers a "7" might be very
different from another customer's "7."
Lack of Clear Boundaries: There are no universally agreed-upon boundaries that separate
"satisfied" from "dissatisfied." For instance, you can't definitively say that a rating of "6" is
completely dissatisfied while "7" is completely satisfied.
Subjectivity: Customer satisfaction is highly subjective. It depends on various factors like personal
preferences, mood, and previous experiences, which are hard to quantify precisely with
probabilities.
In this scenario, measuring membership degrees using fuzzy logic is more appropriate than using
probabilities. With fuzzy logic, you can define fuzzy sets to represent different degrees of
satisfaction, such as "very dissatisfied," "somewhat dissatisfied," "neutral," "somewhat satisfied,"
and "very satisfied." Each customer's satisfaction rating can then be assigned membership degrees
to these fuzzy sets based on how well it matches the set's criteria.
For example, if a customer rates their satisfaction as "7," their membership degree in the
"somewhat satisfied" fuzzy set might be 0.7, indicating a high degree of satisfaction. Another
customer who rates their satisfaction as "7" might have a membership degree of 0.3 in the same
set, indicating a lower level of satisfaction.
Fuzzy logic allows you to capture the imprecise and subjective nature of customer satisfaction
more effectively compared to a purely probabilistic approach, which would require well-defined
probabilities and thresholds that may not be appropriate for this context.
3. Explain a scenario where measurement of probability is more appropriate compare to
membership degree.
Consider the simple act of tossing a fair coin, where you are interested in determining the
likelihood of getting heads or tails. In this scenario:
1. Objective Outcomes: The coin toss has two clear and objective outcomes: heads or tails.
These outcomes are well-defined and do not depend on subjective interpretation.
3. Law of Large Numbers: Probability theory allows you to make precise predictions about
the long-term behavior of coin tosses, such as the expected frequency of heads or tails in a
large number of trials.
4. Statistical Analysis: You can apply statistical techniques, such as calculating the mean,
variance, and standard deviation, to describe the distribution of outcomes over multiple
coin tosses.
In contrast to the coin toss scenario, fuzzy logic and membership degrees are more suitable for
situations where there is uncertainty, imprecision, and subjectivity, as they allow for a more
flexible representation of vague or non-binary concepts.
Membership Function:
A membership function is a fundamental concept in fuzzy logic and fuzzy set theory. It defines the
degree to which an element belongs to a fuzzy set. Fuzzy sets are a generalization of classical
(crisp) sets, allowing elements to belong to a set to varying degrees between 0 and 1, rather than
just being in or out of the set.
A membership function maps each element in the universe of discourse to a value between 0 and
1, representing the degree of membership of that element in the fuzzy set. The membership
function is typically shaped as a curve or graph, and its specific shape depends on the context and
the characteristics of the set it represents. Common shapes include triangular, trapezoidal,
Gaussian, and S-shaped curves.
For example, consider a fuzzy set "Tall" that represents the concept of height. The membership
function for this set may look like a triangular curve, where the base of the triangle represents the
range of heights considered "Tall," and the height of the triangle represents the degree of
membership. So, someone who is exactly at the center of the base would have a membership
degree of 1, while someone at the edges would have a lower degree of membership.
Membership Degree:
A membership degree is a quantitative value that represents the extent to which an element
belongs to a particular fuzzy set. It is obtained by evaluating the element's membership function
for that set. The membership degree can range from 0 (no membership) to 1 (full membership).
The higher the membership degree, the stronger an element belongs to the fuzzy set.
For example, if we have a fuzzy set "Young" with a triangular membership function, and we want
to evaluate the membership degree of a person who is 25 years old, we would look at the value on
the membership function curve at the point 25 on the x-axis. If the value at that point is, say, 0.7, it
means the person has a membership degree of 0.7 in the "Young" set, indicating a relatively strong
membership.
Membership degrees are crucial in fuzzy logic for handling imprecise, uncertain, or vague
information. They allow us to express the degree to which elements satisfy the criteria of a fuzzy
set, which is especially useful in decision-making and control systems that deal with complex, real-
world situations where exact boundaries and crisp classifications are not always applicable.
5. Based on Figure 1, identify the membership degree of elements x1, x2, x3 and x4. Write a
x1 = 1: 1.0
x2 = 3: 1.0
x3 = 5: 0.5
x4 = 7: 0.0
Membership function of fuzzy set A if x1 = 1 and x2 = 3:
0.0 otherwise.
This means that elements in the interval [1, 3] are fully members of the fuzzy set A, elements in
the interval (3, 5) are partially members of the fuzzy set A, and elements outside of these intervals
are not members of the fuzzy set A at all.
This membership function is a triangular function with a base of 2 and a height of 1. The center of
the triangle is at x = 3, and the membership degree is 1.0 at the center and decreases linearly to
0.0 at the edges of the triangle.
Note that the membership function is not explicitly defined for values of x greater than 5. This is
because the membership degree of all elements greater than 5 is 0.0.
6. Given that P(x1)=0.2, P(x2)=0.6, P(x3)=1.0, P(x4)=0.5 and x1<x2<x3<x4, xi∊ℝ. Draw a graph
To create a graph that represents the membership function of P with a triangular shape based on
the given probabilities for each element (x1, x2, x3, x4),
2. Use the provided probabilities to calculate the heights of the membership function at x1,
x3, and x4. These heights represent the degree of membership at each point. The degree of
membership at x1 and x4 will be equal to the given probabilities for x1 and x4, while the
degree of membership at x3 is 1.0.
The reason x2 is ignored in the triangular membership function is that it falls between x1 and x3,
and a triangular membership function typically has its peak at x3. In this context, the triangular
membership function is defined by three key points: the left boundary (x1), the peak (x3), and the
right boundary (x4). The value of x2 is not one of these key points.
Now, plot the graph of the triangular membership function using these parameters:
/\
/ \
/ \
/ \
/ \
/ \
/ \
x1 x3 x4
In this graph, the degree of membership (P) starts at 0.2 at x1, increases linearly to 1.0 at x3 (the
peak), and then decreases linearly to 0.5 at x4. This represents a triangular membership function
for the set P based on the provided probabilities and order of the elements.
7. Develop a reasonable membership function for each of the following fuzzy sets:
a) Cold Weather:
Graph Form: A common representation for a membership function of "cold weather" might be a
trapezoidal shape.
0 0.2 0.5
|___ ___|
/ \ / \
/ \ / \
In this graph, temperatures below 10 degrees Celsius have a low membership degree (0.0),
temperatures between 10 and 15 degrees Celsius have a moderate membership degree (0.2 to
0.5), and temperatures above 15 degrees Celsius have a very low membership degree (0.0).
Equation Form:
You can represent the membership function for "cold weather" in equation form as follows:
Graph Form:
\ | /
\ | /
\ | /
\|/
\|
-10 0
In this graph, temperatures below -10 degrees Celsius have a membership degree of 0.0,
temperatures around -10 degrees have a moderate membership degree (0.5), and temperatures
above -10 degrees have a membership degree of 0.0.
Equation Form: The membership function for "very cold weather" can be represented in equation
form as follows:
c) Warm Weather:
Graph Form:
A triangular membership function is often suitable for "warm weather" as well. Here's a visual
representation:
| /\
|/ \
|/ \
20 30
In this graph, temperatures below 20 degrees Celsius have a membership degree of 0.0,
temperatures around 25 degrees have a moderate membership degree (0.5), and temperatures
above 30 degrees have a membership degree of 0.0.
Equation Form:
The membership function for "warm weather" can be represented in equation form as follows:
These are just example membership functions. The specific shape and parameters of these
functions can be adjusted based on your particular context or preferences.
Figure 1