Fuzzy Logic Applications
Fuzzy Logic Applications
frame numerical where i can apply fuzz membership functions like triangle trapezoidal and apply
them in real and help me to solve understand applications to real scenarios
To understand and apply fuzzy membership functions like triangular and trapezoidal in real-world
scenarios, it's helpful to organize the knowledge in a structured framework. Here’s a practical framing
that connects fuzzy membership functions to numerical applications in real-world problems:
Fuzzy membership functions map real-valued inputs to a range [0, 1] — representing degrees of truth
or membership rather than crisp binary values.
Component Description
Fuzzification Apply fuzzy membership functions to map crisp input into fuzzy values
Rules (optional) Use fuzzy logic rules (if-then) to relate input to decisions
Defuzzification Convert fuzzy result back into a crisp output (if needed)
Membership Functions:
Cold: Trapezoidal [0, 0, 15, 20]
Membership Functions:
Low: Trapezoidal [0, 0, 40, 50]
Would you like a Python code example using `scikit-fuzzy` to illustrate one of these scenarios?
It looks like the `scikit-fuzzy` (`skfuzzy`) library isn't available in this environment. However, I can still
generate the membership functions and plots using pure NumPy, without relying on `skfuzzy`.
Let me proceed by manually defining the triangular and trapezoidal membership functions for the
thermostat control example and plotting them.
Here's the plot showing fuzzy membership functions for room temperature:
This illustrates how temperature is fuzzified into overlapping categories, useful for decisions like turning
on/off a heater or AC.
Would you like to proceed with a rule-based decision output and show how to compute the final action
from a given temperature input?
i dont want code here lets solve individual numerical in each membership function type first
Perfect — let's solve individual numericals for each fuzzy membership function type step by step
without code. We'll start with the triangular membership function, then move to trapezoidal.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 3/42
🔶 1. Triangular Membership Function — Numerical Problem
Function definition:
For a triangular membership function defined by (a, b, c), the membership degree μ(x) is:
⎧0, x ≤ a or x ≥ c
μ(x) = ⎨ x−a , a<x≤b
⎩ c−x
b−a
c−b
, b<x<c
Problem 1:
Given a triangular membership function with parameters a = 10, b = 20, c = 30, calculate the
membership value μ(x) for:
x=5
x = 15
x = 20
x = 25
x = 35
Solution:
1. x= 5:
Since x < a = 10, μ(5) = 0
2. x= 15:
Since 10 < x ≤ 20,
15 − 10 5
μ(15) = = = 0.5
20 − 10 10
3. x = 20:
At the peak x = b, μ(20) = 1
4. x= 25:
Since 20 < x < 30,
30 − 25 5
μ(25) = = = 0.5
30 − 20 10
5. x= 35:
Since x > c = 30, μ(35) = 0
35 0
can fit this numerical into some real life application scenario
Absolutely! Let's fit the triangular membership function numerical into a real-world scenario to see
how fuzzy logic helps in decision-making.
So:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 5/42
Room Temp (∘ C ) μModerate (x)
Interpretation Fan Speed Suggestion
35 0 Too hot, not moderate High speed (based on "Hot" fuzzy set)
✅ Insight
The membership values don’t abruptly jump like in crisp logic.
At 15°C, we can say the room is 50% moderately warm, suggesting a partial fan speed.
This allows smooth transitions between states (low to medium speed) — more natural and
adaptive.
Would you like to now move on to a trapezoidal membership function numerical with a real-life case?
Great! Let's explore more examples of triangular membership functions applied to real-life
temperature-based control systems—specifically focusing on how different systems interpret varying
temperatures using fuzzy logic.
a = 22∘ C
b = 27∘ C
c = 32∘ C
Temperature Inputs:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 6/42
Temperature (∘ C ) Membership μWarm (x)
Interpretation AC Action
a = 5∘ C , b = 10∘ C , c = 15∘ C
🔑 Key Takeaways:
Triangular functions are perfect for transitions where a single value is most representative (the
peak), and we smoothly scale up or down around it.
Common in control systems, recommendation engines, automation, and adaptive systems.
Would you like to explore how these triangular sets interact in multi-rule fuzzy systems next, or move
on to trapezoidal membership function examples?
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 7/42
tell me solve complete step by step what is given in numerical? is anything assumed here ?
Great question — let’s break it down step-by-step: how to formulate, solve, and interpret a numerical
involving a triangular membership function — and what is given vs what is assumed.
🔶 Problem Statement:
A fuzzy set "Moderate Temperature" is represented by a triangular membership function
with parameters a = 10, b = 20, and c = 30.
Find the membership values μ(x) for x = 5, 15, 20, 25, 35.
Parameters of triangle:
⎧0, x ≤ a or x ≥ c
μ(x) = ⎨ x−a
b−a , a < x ≤ b
⎩ c−x
c−b
, b<x<c
This formula is standard and implicitly assumed as the definition of the triangular membership
function.
🧾 Final Table:
x Membership Value μ(x)
5 0
15 0.5
20 1
25 0.5
35 0
✅ Summary:
Given: Triangle parameters, input values
Used: Standard triangular function formula (not assumed arbitrarily, just standard)
Solved: Direct substitution into piecewise formula
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 9/42
Would you like me to now solve a similar step-by-step trapezoidal membership function numerical
with clear identification of what's given and what's assumed?
Yes, absolutely — fuzzy membership function numericals (especially triangular and trapezoidal types)
can come in various patterns. What we did earlier was just a direct evaluation problem, but there are
multiple types of numerical patterns in fuzzy logic. Here's a categorized list with examples:
Example:
Given a = 10, b = 20, c = 30, find μ(15)
✔️ Used in control systems, smart appliances, etc.
✅ 2. Reverse Evaluation (Find x for a given μ(x))
Given: μ(x) = 0.6, triangle: a = 10, b = 20, c = 30
Find: Value(s) of x
Since two sides can give the same membership value (ascending and descending slopes), you get two
solutions:
x − 10
0.6 = ⇒ x = 16
10
30 − x
0.6 = ⇒ x = 24
10
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 10/42
Example:
0.4 × 10 + 0.7 × 20
RPMdefuzzified = =…
0.4 + 0.7
Identify parameters a, b, c
Would you like to practice one of these types next, like a reverse evaluation or defuzzification?
Perfect — let’s solve a complete example with fuzzification and defuzzification, step by step.
We'll walk through:
1. Fuzzification – Convert a crisp input into fuzzy values using triangular membership functions.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 12/42
🔹 Step 2: Fuzzification (Crisp input → fuzzy values)
Given: Room temperature = 25°C
✅ Final Result:
Crisp Input: 25°C
Fuzzy Degrees:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 13/42
Comfortable: 0.25
Hot: 0.167
Crisp Output (Defuzzified): ≈ 2398 RPM
Would you like to try solving a similar example yourself next, or go deeper into how the fuzzy rule base
could be expanded?
some problems on topics but now first give questions . dont give answers until i asks
Great! Here are some problems involving fuzzification and defuzzification using triangular and
trapezoidal membership functions. I'll hold off on solving them until you ask.
x = 18∘ C
x = 22∘ C
x = 25∘ C
x = 28∘ C
x = 32∘ C
μ(x) = 0.5
μ(x) = 0.8
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 14/42
x = 15
x = 25
x = 35
x = 45
Low: 1000 W
Medium: 2000 W
High: 3000 W
🔷 Problem Recap:
A triangular membership function represents “Comfortable” temperature with parameters:
a = 18∘ C , b = 24∘ C , c = 30∘ C
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 15/42
You are asked to find the possible values of x for which:
μ(x) = 0.5
μ(x) = 0.8
c−b ,b<x<c
Given:
a = 18, b = 24, c = 30
So:
✔️ One solution is x = 21
🔸 Right side (descending):
30 − x 30 − x
0.5 = = ⇒ 30 − x = 3 ⇒ x = 27
30 − 24 6
✔️ Another solution is x = 27
✅ Final Answer for μ(x) = 0.5:
x = 21∘ C or x = 27∘ C
Excellent question. Let's clarify and define the fuzzy sets needed for Problem 4, and confirm where x =
∘
20 C fits.
🔷 Problem 4 Recap:
Input variable: Temperature
Given fuzzy set:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 17/42
🔹 Step 1: Confirm if x = 20 belongs to "Cold"
Cold = triangle (0, 15, 30)
Since:
Use:
30 − x 30 − 20 10
μCold (x) = = = ≈ 0.667
30 − 15 15 15
Why?
At x = 20:
Then:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 18/42
Fuzzy Set Degree (μ)
Cold 0.667
Warm 0.286
Hot 0.000
Would you like to proceed with the rule activation and defuzzification steps next?
Excellent — this is a very important part of fuzzy logic: understanding how and why we assume fuzzy
sets like triangle/trapezoid shapes. This is where design skill and intuition play a big role.
Let me break it down clearly.
"At what crisp values does this fuzzy label start, peak, and stop being true?"
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 19/42
Cold: (0, 15, 30)
Warm: (18, 25, 32)
Example: if the input can range 0°C–45°C, make sure the union of fuzzy sets covers it
4. Symmetry is not necessary, but helps:
You can define fuzzy sets wider or narrower depending on how vague or sharp the concept is.
E.g., “Comfortable” might have a narrow triangle, but “Hot” might be broader.
🔷 In Summary:
Design Goal What You Do
Smooth transitions Overlap adjacent fuzzy sets
Would you like to try defining a fuzzy set from scratch now using this reasoning?
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 20/42
defuzzification steps next problem 4
Great! Let's now move on to Defuzzification for Problem 4, using the fuzzified values we calculated.
∑(μi ⋅ Outputi )
Crisp Output =
∑ μi
🔸 Step-by-step Calculation:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 21/42
Numerator = (2001) + (572) = 2573
✅ Final Answer:
The heater should output ≈ 2701 Watts for an input temperature of 20°C.
Would you like to try visualizing this or explore how changing the temperature affects the output?
x = 15
x = 25
x = 35
x = 45
μ(x) = ⎨
x−a
b−a
, a<x≤b
⎩ d−x
1, b<x<c
d−c
, c≤x<d
Given:
a = 10, b = 20, c = 30, d = 40
🔹 x = 25
Range: 20 < x < 30 → top flat part
μ(25) = 1
🔹 x = 35
Range: 30 ≤ x < 40 → right slope
40 − 35 5
μ(35) = = = 0.5
40 − 30 10
🔹 x = 45
Range: x ≥ 40 → outside range
μ(45) = 0
✅ Final Answers:
x μ(x)
15 0.5
25 1.0
35 0.5
45 0.0
Would you like to now use trapezoidal sets in a defuzzification example similar to the heater power
one?
Great! Let’s go through a complete fuzzy logic example using a trapezoidal membership function,
covering both fuzzification and defuzzification, with all necessary data provided.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 23/42
🔷 Real-World Scenario: Fan Speed Control Based on Room
Temperature
Goal: Automatically decide the fan speed (in RPM) based on room temperature using fuzzy logic.
🔷 Step 3: Fuzzification
We compute μModerate (x) using trapezoidal rule.
Trapezoid parameters:
Range:
So,
✅ Final Output:
At 24°C, the fuzzy controller sets the fan speed to 1500 RPM.
Would you like a version of this example involving multiple fuzzy sets and overlapping membership
for a richer defuzzification case?
Build a fuzzy inference system (FIS) for a washing machine where inputs are "Dirt Level" and "Cloth
Type", and the output is "Wash Time". Show fuzzification, rules, inference, and defuzzification.
Excellent! Let’s design a complete Fuzzy Inference System (FIS) for a washing machine, with detailed
steps from fuzzification to defuzzification.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 25/42
Fuzzy Set Type Parameters
High Triangular (5, 10, 10)
Short 20
Medium 40
Long 60
Dirt Level = 6
Cloth Type = 4
🔷 Step 5: Fuzzification
📌 For Dirt Level = 6:
Low → triangle (0, 0, 5): x >5⇒μ=0
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 26/42
Medium → (3, 5, 7): 5 < 6 < 7 → descending slope
7−6 1
μ= 7−5
= 2
= 0.5
High → (5, 10, 10): 5 < 6 < 10 → ascending slope
6−5 1
μ= 10−5
= 5
= 0.2
High: 0.2
Medium → 40 minutes
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 27/42
✅ Summary:
Inputs: Dirt Level = 6, Cloth Type = 4
Fuzzification: Medium Dirt (0.5), High Dirt (0.2), Normal Cloth (0.5), Delicate Cloth (0.25)
Rules Fired: R3 and R5 (both to Medium wash time)
Defuzzified Wash Time: 40 minutes
Would you like a visual diagram of the fuzzy sets or rule base as a next step?
Great question! Let's break down how the rule evaluation (inference) is done in a fuzzy inference
system like this washing machine example.
Normal: 0.5
Delicate: 0.25
IF Dirt Level is Medium AND Cloth Type is Normal THEN Wash Time is Medium
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 28/42
We already fuzzified:
So, this rule fires with strength 0.5, meaning 50% of the "Medium Wash Time" fuzzy set is active.
We have:
Then:
🔸 How It Helps:
Each rule produces a fuzzy output contribution, and in defuzzification, all contributions are
aggregated (usually with a weighted average of their crisp representatives).
Would you like to see how this changes if we use a different logic (e.g., product instead of min)?
Ah, now I see what you're asking — thank you for the clarification!
You're asking: Why were only Rule R3 and R5 evaluated, and not all 5 rules, in the fuzzy inference
process?
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 29/42
Let’s walk through that logically and thoroughly:
Dirt Level = 6
Cloth Type = 4
We fuzzified:
Dirt Level:
Cloth Type:
Delicate: 0.25
Normal: 0.5
Rough: 0 → because 4 is below Rough’s lower boundary (which starts at 5)
✅ Included
🔹 R4: High AND Rough
μHigh = 0.2, μRough = 0
✅ Included
✅ Final Conclusion
Only R3 and R5 fire because only they have non-zero membership degrees in both of their
conditions.
All other rules have at least one condition with membership degree = 0, and in fuzzy AND, that causes
the entire rule to not activate (firing strength = 0).
Let me know if you’d like to try a case where 3 or more rules fire together for richer inference!
Construct a basic fuzzy logic system for temperature control (input: temperature, output: fan
speed).
Perfect! Let's construct a basic fuzzy logic system for temperature control — a classic example —
where the goal is to adjust fan speed based on the input temperature.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 31/42
🔹 Step 1: Define Input and Output Variables
🟡 Input: Temperature (°C)
Range: 0 – 40°C
Fuzzy Sets:
Fuzzy Sets:
Low → Triangular (0, 0, 1500)
Medium → Triangular (1000, 2000, 3000)
High → Triangular (2000, 3000, 3000)
Temperature = 28°C
🔹 Step 4: Fuzzification
Evaluate membership degrees at 28°C:
0.7 ⋅ 2000
Fan Speed = = 2000 RPM
0.7
✅ Final Output:
At 28°C, the system sets fan speed to 2000 RPM.
Would you like to extend this to handle overlapping fuzzy sets with multiple rule firing and do centroid-
based defuzzification?
Give a simple fuzzy set calculation example. Assume input = 30°C. Calculate membership for "Warm"
and "Hot" if membership functions are given.
Great! Let’s walk through a simple fuzzy set calculation using an input of 30°C to compute
membership values for fuzzy sets "Warm" and "Hot".
🔷 Given:
Input temperature: 30°C
🔹 Fuzzy sets:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 33/42
1. Warm → Triangular (15, 25, 35)
Peak at 25°C
Membership is:
⎧0 x ≤ 15 or x ≥ 35
μWarm (x) = ⎨ x−15 15 < x ≤ 25
⎩ 35−x
10
10
25 < x < 35
⎧0 x ≤ 30
μHot (x) = ⎨ x−30 30 < x < 40
⎩
10
1 x = 40
35 − 30 5
μWarm (30) = = = 0.5
10 10
✅ For Hot:
x = 30, and according to the definition:
μHot (30) = 0
✅ Final Result:
Fuzzy Set Membership at 30°C
Warm 0.5
Hot 0.0
Would you like to try a value like 33°C next, where both sets overlap and you get non-zero membership
in both?
Apply Fuzzy Set theory to a traffic control system. Inputs: traffic density and time of day. Output:
signal time. Use membership functions and fuzzy rules to compute the result.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 34/42
Let's build a fuzzy logic-based Traffic Control System using:
Traffic Density = 70
Time of Day = 18
🚦 Step 4: Fuzzification
🔹 Traffic Density = 70
Low: 0 (beyond upper boundary)
Medium: Between 50–80
80 − 70 10
μ= = = 0.33
80 − 50 30
70 − 60 10
μ= = = 0.25
100 − 60 40
✅ Result:
Medium = 0.33
High = 0.25
🔹 Time of Day = 18
Normal: Between 14–20
20 − 18 2
μ= = ≈ 0.33
20 − 14 6
18 − 17 1
μ= = ≈ 0.33
20 − 17 3
✅ Result:
Normal = 0.33
Peak = 0.33
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 36/42
Only these rules apply due to non-zero membership.
Medium = 65 sec
Long = 100 sec
✅ Final Output
At traffic density of 70 cars/min and 6 PM, set green signal time to ~80 seconds.
Would you like to test this with a different input, like morning off-peak or low traffic?
In a fuzzy set of 'Tall people,' if a person has a height of 180 cm and the membership function for
'Tall' at 180 cm is 0.8, what is the degree of membership of that person in the fuzzy set?
In a fuzzy set, the degree of membership represents how strongly an element belongs to the set,
based on a membership function.
✅ Given:
Fuzzy set: Tall people
🔹 Therefore:
The degree of membership of the person in the fuzzy set 'Tall people' is 0.8.
This means the person is considered "80% tall" according to the fuzzy logic definition of "Tall".
Would you like to visualize the fuzzy set curve or try another height?
Design a fuzzy rule-based system to determine water level in a tank (inputs: water inflow and
outflow). Show sample membership functions
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 37/42
Let's design a fuzzy rule-based system to determine the Water Level in a tank based on:
Inputs:
1. Inflow Rate (liters/min)
2. Outflow Rate (liters/min)
Output:
Water Level (in percentage of tank capacity)
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 38/42
| R5 | Low | Low | Medium |
| R6 | Medium | Low | High |
| R7 | Medium | High | Low |
markdown
/\
/ \
/ \
____/ \________
0 25 50 75 100
Low: peak at 0
Medium: peak at 50
High: peak at 100
markdown
/\
/ \
/ \
____/ \________
0 30 50 70 100
Inflow = 60
Outflow = 30
→ We'll fuzzify inputs, apply rules, then defuzzify to get output (water level %).
Would you like to proceed step-by-step through fuzzification, rule activation, and defuzzification using
this input?
yes
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 39/42
Inflow = 60 L/min
Outflow = 30 L/min
🔹 Step 1: Fuzzification
📥 Inflow = 60
Membership in:
75 − 60 15
μMedium (60) = = = 0.6
75 − 50 25
60 − 50 10
μHigh (60) = = = 0.2
100 − 50 50
✅ Inflow memberships:
Medium = 0.6
High = 0.2
📤 Outflow = 30
Membership in:
40 − 30 10
μLow (30) = = = 0.25
40 − 0 40
30 − 20 10
μMedium (30) = = ≈ 0.33
50 − 20 30
✅ Outflow memberships:
Low = 0.25
Medium = 0.33
🔸 Rule Matches:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 40/42
✅ R2: If Inflow High (0.2) AND Outflow Low (0.25) → Water Level High
Firing strength = min(0.2, 0.25) = 0.2
✅ R3: Inflow Medium (0.6) AND Outflow Medium (0.33) → Water Level Medium
min(0.6, 0.33) = 0.33
✅ R6: Inflow Medium (0.6) AND Outflow Low (0.25) → Water Level High
min(0.6, 0.25) = 0.25
High = 90%
Medium = 50%
Now compute:
18 + 16.5 + 22.5 57
= = ≈ 73.1%
0.78 0.78
✅ Final Result:
Based on fuzzy logic, the water level should be set to approximately 73% of tank capacity.
Would you like to visualize the membership diagrams or try another input?
A pump controller can't understand "Water Level is partly High and partly Medium."
It needs a specific level, like 73%, to decide how long to run or when to stop.
Thus, while we model uncertainty with fuzzy sets, we always defuzzify before acting.
1. Rule Evaluation activates fuzzy output sets (e.g., "Water Level is High" gets activated with 0.25).
2. These partial fuzzy sets are combined to create a fuzzy aggregated output.
3. Finally, the aggregated fuzzy output is defuzzified to get a crisp value (e.g., 73%).
Would you like to see a visualization of how fuzzy outputs are combined before defuzzification?
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 42/42