0% found this document useful (0 votes)
35 views42 pages

Fuzzy Logic Applications

The document discusses the application of fuzzy logic, specifically triangular and trapezoidal membership functions, in real-world scenarios such as temperature control, speed regulation in cars, and health assessments. It outlines a structured approach to using these functions, including fuzzification, rule application, and defuzzification, along with practical examples and numerical problems. Additionally, it emphasizes the importance of smooth transitions in decision-making processes enabled by fuzzy logic.

Uploaded by

ojrane16124
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views42 pages

Fuzzy Logic Applications

The document discusses the application of fuzzy logic, specifically triangular and trapezoidal membership functions, in real-world scenarios such as temperature control, speed regulation in cars, and health assessments. It outlines a structured approach to using these functions, including fuzzification, rule application, and defuzzification, along with practical examples and numerical problems. Additionally, it emphasizes the importance of smooth transitions in decision-making processes enabled by fuzzy logic.

Uploaded by

ojrane16124
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

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:

🔶 Step 1: Understand Fuzzy Membership Functions


A. What Are They?

Fuzzy membership functions map real-valued inputs to a range [0, 1] — representing degrees of truth
or membership rather than crisp binary values.

Type Shape Parameters

Triangular /\ a, b, c: left, peak, right


Trapezoidal ┌───┐ a, b, c, d: left foot, left shoulder, right shoulder, right foot

🔷 Step 2: Create a Numerical Frame for Application


Let's define a general frame where you can plug in membership functions:

Component Description

Input Variable(s) Real-world quantity (temperature, speed, age, etc.)

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)

Output Decision, classification, score, etc.

🔶 Step 3: Real-World Scenarios with Examples


1. Thermostat Control (Temperature Management)

Input: Room temperature (°C)

Membership Functions:
Cold: Trapezoidal [0, 0, 15, 20]

Comfortable: Triangular [18, 22, 26]


Hot: Trapezoidal [24, 28, 40, 40]
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 1/42
Rule:
If Temperature is Cold, then turn Heater ON High

If Temperature is Comfortable, then Heater OFF


Application: Smart thermostats (IoT, HVAC)

2. Speed Control in Cars (Cruise Control System)

Input: Speed error (desired - actual)


Membership Functions:

Negative (too slow): Triangular [−20, −10, 0]

Zero (on target): Triangular [−5, 0, 5]

Positive (too fast): Triangular [0, 10, 20]


Rule:
If Error is Negative, then Accelerate

If Error is Positive, then Decelerate

Application: Adaptive cruise control

3. Student Performance Grading

Input: Marks (0–100)

Membership Functions:
Low: Trapezoidal [0, 0, 40, 50]

Medium: Triangular [45, 60, 75]

High: Trapezoidal [70, 85, 100, 100]

Application: AI-based feedback or evaluation systems

4. Health Risk Assessment

Input: BMI value


Membership Functions:

Underweight: Triangular [0, 16.5, 18.5]

Normal: Triangular [18, 21.5, 24.9]


Overweight: Triangular [24, 27.5, 30]

Obese: Trapezoidal [29, 32, 40, 40]

Application: Personalized health monitoring

🔷 Step 4: Tools and Implementation


Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 2/42
You can implement these using:

Python with `scikit-fuzzy`


MATLAB Fuzzy Logic Toolbox

Simulink for simulation

Embedded Systems for real-time control

Would you like a Python code example using `scikit-fuzzy` to illustrate one of these scenarios?

solve and draw them

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:

Cold (blue): Covers 0–20°C with a trapezoidal shape.

Comfortable (green): A triangular peak from 18°C to 26°C centered at 22°C.


Hot (red): Covers 24–40°C with another trapezoid.

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

✅ Final Answer Table:


Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 4/42
x μ(x)
5 0
15 0.5
20 1
25 0.5

35 0

Would you like to proceed to a trapezoidal membership function example next?

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.

🔷 Scenario: Fan Speed Control Based on Room Temperature


You’re designing a fuzzy system to adjust fan speed based on room temperature. You want the system
to understand whether the room is:

Cool (no need for a fan),

Moderate (low or medium speed),


Hot (high fan speed).

🔶 Triangular Membership Function: "Moderate" Temperature


Define fuzzy set Moderate with:

a = 10∘ C (start of moderate)


b = 20∘ C (ideal moderate)
c = 30∘ C (end of moderate)

So:

Below 10∘ C : clearly not moderate

At 20∘ C : fully moderate

Beyond 30∘ C : no longer moderate

🔢 Real Temperature Inputs and Fan Logic


Let’s take our earlier results:

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 5/42
Room Temp (∘ C ) μModerate (x)​
Interpretation Fan Speed Suggestion

5 0 Too cold Off


15 0.5 Somewhat moderate Low speed
20 1 Perfectly moderate Medium speed
25 0.5 Somewhat hot Low or medium

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?

some more example on same topic

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.

🔷 Example 2: Air Conditioner (AC) Cooling Intensity


Fuzzy Set: "Warm"

Triangular membership function defined as:

a = 22∘ C
b = 27∘ C
c = 32∘ C

This represents the fuzzy concept of "Warm temperature."

Temperature Inputs:

Temperature (∘ C ) Membership μWarm (x)



Interpretation AC Action

20 0 Too cool AC idle


24−22
24 27−22
​ = 0.4 Slightly warm AC starts lightly

27 1 Perfectly warm Moderate cooling


32−30
30 32−27

= 0.4 Becoming hot High cooling begins

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 6/42
Temperature (∘ C ) Membership μWarm (x) ​
Interpretation AC Action

35 0 Too hot (outside warm zone) Use separate "Hot" rule

🔷 Example 3: Fuzzy Clothing Advice System


Fuzzy Set: "Cool Day"

a = 5∘ C , b = 10∘ C , c = 15∘ C

This fuzzy set helps decide if someone should wear a jacket.

Temp μCool (x)



Clothing Suggestion

2 0 Definitely cold – coat


7−5
7 10−5
​ = 0.4 Slightly cool – light jacket

10 1 Cool – wear sweater


15−13
13 15−10
​ = 0.4 Warming up – maybe no jacket

18 0 Not cool anymore

🔷 Example 4: Agricultural Irrigation Based on Soil Temperature


Fuzzy Set: "Optimal Root Growth Temperature"

Triangle: a = 12∘ C , b = 18∘ C , c = 24∘ C

Use case: Decide whether to irrigate or delay based on root activity.

Soil Temp μOptimal (x)



Action

10 0 Too cold – delay irrigation


15−12
15 18−12
​ = 0.5 Moderate root activity – light irrigation

18 1 Ideal – irrigate fully


24−22
22 24−18
​ = 0.33 Warming up – reduce irrigation

26 0 Too hot – switch to shade-tolerant plan

🔑 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.

🔷 Step-by-Step Breakdown of a Triangular Membership Function


Numerical
Let’s take the earlier example:

🔶 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.

✅ Step 1: What is Given?


Fuzzy set: "Moderate Temperature"
Membership function type: Triangular

Parameters of triangle:

a = 10: left foot of the triangle


b = 20: peak (full membership)
c = 30: right foot of the triangle
Input values (crisp values): x = 5, 15, 20, 25, 35

❓ Step 2: What is Assumed?


Nothing extra is assumed except standard fuzzy logic interpretation of a triangular membership
function:

⎧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.

🧮 Step 3: Apply the Formula


Let’s solve each input step by step.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 8/42
🔹 (i) For x = 5:
x = 5 < a = 10 ⇒ μ(5) = 0

🔹 (ii) For x = 15:


Since 10 < x = 15 ≤ 20,
15 − 10 5
μ(15) = = = 0.5
20 − 10 10
​ ​

🔹 (iii) For x = 20:


x = b = 20 ⇒ μ(20) = 1

🔹 (iv) For x = 25:


Since 20 < x = 25 < 30,
30 − 25 5
μ(25) = = = 0.5
30 − 20 10
​ ​

🔹 (v) For x = 35:


x = 35 > c = 30 ⇒ μ(35) = 0

🧾 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

No extra assumption: Just the mathematical definition of a triangular fuzzy set

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?

are there more patterns in this numericals

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:

🔷 Types of Patterns in Fuzzy Membership Function Numericals


✅ 1. Direct Evaluation of Membership Value
(What we've done already)

Given: Triangle params (a, b, c), input x


Find: μ(x)

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:

1. From left side:

x − 10
0.6 = ⇒ x = 16
10

2. From right side:

30 − x
0.6 = ⇒ x = 24
10

✔️ Used in fuzzy inference & system interpretation


✅ 3. Defuzzification Problems (e.g., Centroid Method)
Combine multiple fuzzy outputs to get a crisp output
(usually after rule evaluation)

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 10/42
Example:

If a fuzzy fan control system gives:

Low speed: μ = 0.4 at 10 RPM


Medium speed: μ = 0.7 at 20 RPM

Use weighted average to get crisp RPM

0.4 × 10 + 0.7 × 20
RPMdefuzzified = =…
0.4 + 0.7
​ ​

✔️ Used in final decision outputs


✅ 4. Graph-Based Questions
Given a graph of membership function:

Identify parameters a, b, c

Estimate or read off μ(x)

Sketch fuzzy sets from parameters

✔️ Common in exams or interviews


✅ 5. Overlapping Membership Evaluation
For input x, find membership in multiple fuzzy sets (like Cold, Moderate, Hot)

E.g., x = 25∘ C may have:

μModerate (x) = 0.3


μHot (x) = 0.6


✔️ Used in rule-based systems to trigger fuzzy rules


✅ 6. Fuzzy Set Construction from Descriptions
Given a vague description like "Comfortable temperature is around 22°C, tolerable between
18–26°C,"
Construct a triangular or trapezoidal function:

Triangle: (18, 22, 26)

Trapezoid: (18, 20, 24, 26)

✔️ Common in design problems and real-world fuzzy modeling


🧠 Summary of Patterns:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 11/42
Pattern Type Common Task

Direct Evaluation Find μ(x) from x

Reverse Evaluation Find x from μ(x)

Defuzzification Get crisp value


Graph Interpretation Identify shape or value
Overlap/Rule Evaluation Use multiple sets at once
Set Construction Build fuzzy set from words

Would you like to practice one of these types next, like a reverse evaluation or defuzzification?

I want to solve example with fuzzification and defuzzication

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.

2. Apply fuzzy rules (briefly).


3. Defuzzification – Convert fuzzy outputs into a crisp, actionable result.

🔷 Problem: Fan Speed Control Based on Temperature


🎯 Objective:
Based on room temperature, control fan speed using fuzzy logic.

🔹 Step 1: Define Fuzzy Sets


🔸 Input Variable: Temperature (°C)
Fuzzy Set Type Parameters (a, b, c)

Cold Triangle (0, 10, 20)


Comfortable Triangle (18, 22, 26)
Hot Triangle (24, 30, 36)

🔸 Output Variable: Fan Speed (RPM)


Fuzzy Set RPM Value Degree (to be computed)

Low 1000 From "Cold" degree


Medium 2000 From "Comfortable" degree
High 3000 From "Hot" degree

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

Let’s compute the degree of membership in each fuzzy set.

🔸 1. Cold: Triangle (0, 10, 20)


Since 25 > 20, μCold (25) = 0

🔸 2. Comfortable: Triangle (18, 22, 26)


Since 22 < 25 < 26:
26 − 25 1
μComfortable (25) = = = 0.25
26 − 22 4
​ ​ ​

🔸 3. Hot: Triangle (24, 30, 36)


Since 24 < 25 < 30:
25 − 24 1
μHot (25) = = ≈ 0.167
30 − 24 6
​ ​ ​

🔹 Step 3: Rule Base (simplified)


We assume:

IF Temp is Comfortable → Fan = Medium


IF Temp is Hot → Fan = High

We ignore Cold (0 membership)

🔹 Step 4: Defuzzification (Weighted Average)


Use centroid method:

(0.25 × 2000) + (0.167 × 3000)


Fan Speed =
0.25 + 0.167

500 + 500 1000


= ≈ ≈ 2398 RPM
0.417 0.417
​ ​

✅ 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.

🔷 Fuzzification and Defuzzification Problems (Questions Only)


🔹 Problem 1: Fuzzification (Triangular)
A fuzzy set “Warm Temperature” is defined as a triangular membership function with parameters a =
∘ ∘ ∘
20 C , b = 25 C , and c = 30 C .
Find the membership values for:

x = 18∘ C
x = 22∘ C
x = 25∘ C
x = 28∘ C
x = 32∘ C

🔹 Problem 2: Reverse Fuzzification


A triangular membership function represents “Comfortable” temperature with parameters a = 18, b =
24, c = 30.
Find the possible values of x for which:

μ(x) = 0.5
μ(x) = 0.8

🔹 Problem 3: Fuzzification (Trapezoidal)


A trapezoidal membership function for “Medium Speed” is defined with parameters a = 10, b = 20,
c = 30, d = 40.
Find the membership value for:

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 14/42
x = 15
x = 25
x = 35
x = 45

🔹 Problem 4: Complete System (Fuzzification + Rule + Defuzzification)


You are designing an automatic water heater. The input fuzzy set is “Cold” water temperature, defined as
triangle a = 0∘ C , b = 15∘ C , c = 30∘ C .
The output fuzzy set for heater power is:

Low: 1000 W
Medium: 2000 W

High: 3000 W

Use rule base:

If temperature is Cold, heater power is High

If temperature is Warm, heater power is Medium


If temperature is Hot, heater power is Low

Given input: x = 20∘ C


Assume appropriate fuzzy sets for Warm and Hot if needed.

🔹 Problem 5: Construct Fuzzy Set


Create a triangular membership function for the fuzzy set "Tolerable Noise Level" in dB, given that:

It starts becoming tolerable at 30 dB,

It is most tolerable at 45 dB,


And becomes intolerable beyond 60 dB.

Let me know which one you'd like to solve first!

solve:Problem 2: Reverse Fuzzification

Great — let’s solve Problem 2: Reverse Fuzzification, step by step.

🔷 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

🔹 Step 1: Recall Triangular Membership Function Formula


⎧0, x ≤ a or x ≥ c
μ(x) = ⎨ b−a , a < x ≤ b
x−a
⎩ c−x
​ ​ ​

c−b ,​b<x<c

Given:
a = 18, b = 24, c = 30
So:

Ascending slope (left side): a <x≤b


Descending slope (right side): b <x<c

We solve both sides.

🔶 Part A: For μ(x) = 0.5


🔸 Left side (ascending):
x − 18 x − 18
0.5 = = ⇒ x − 18 = 3 ⇒ x = 21
24 − 18 6
​ ​

✔️ 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

🔶 Part B: For μ(x) = 0.8


🔸 Left side (ascending):
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 16/42
x − 18
0.8 = ⇒ x − 18 = 4.8 ⇒ x = 22.8
6

✔️ One solution is x = 22.8


🔸 Right side (descending):
30 − x
0.8 = ⇒ 30 − x = 4.8 ⇒ x = 25.2
6

✔️ Another solution is x = 25.2


✅ Final Answer for μ(x) = 0.8:
x = 22.8∘ C or x = 25.2∘ C

Would you like to graph this or move to the next problem?

In problem 4: Given input:


𝑥 = 20 is for cold ?

Assume appropriate fuzzy sets for Warm and Hot if needed.

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:

“Cold” temperature = triangular: a = 0, b = 15, c = 30

Output variable: Heater Power

Cold → High (3000 W)


Warm → Medium (2000 W)

Hot → Low (1000 W)

Given input: x = 20∘ C


We're told:

"Assume appropriate fuzzy sets for Warm and Hot"

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:

15 < x = 20 < 30 → we're on the descending slope

Use:

30 − x 30 − 20 10
μCold (x) = = = ≈ 0.667
30 − 15 15 15
​ ​ ​

✅ So yes, x = 20 is "partly Cold" with degree 0.667


🔹 Step 2: Define fuzzy set for Warm
Let's define:

Warm = triangle (18, 25, 32)

Why?

So that it overlaps with Cold (around 18–25)

And overlaps with Hot later

At x = 20:

18 < x < 25 → ascending slope of Warm


20 − 18 2
μWarm (20) = = ≈ 0.286
25 − 18 7
​ ​ ​

✅ So x = 20 is also partly Warm with degree ≈ 0.286


🔹 Step 3: Define fuzzy set for Hot
Let’s assume:

Hot = triangle (30, 36, 42)

Then:

Since x = 20 < 30, it is not Hot → μHot (20) = 0


✅ Final Fuzzification Summary:


At x = 20∘ C :

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?

help me understand how do we assume value. what is logic or tick in it

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.

🔷 How Do We Assume Fuzzy Set Parameters (a, b, c or a, b, c, d)?


Fuzzy logic is designed to model human reasoning — which is often vague or linguistic.
So, when we define a fuzzy set (like “Warm temperature” or “Medium speed”), we are answering:

"At what crisp values does this fuzzy label start, peak, and stop being true?"

🔶 For Triangular Membership (a, b, c):


Parameter Meaning
a When the concept starts being "relevant"

b When it is fully true (peak, μ = 1)


c When it stops being relevant (μ = 0)

✅ Logical Guiding Principles:


1. Overlap fuzzy sets — adjacent sets like “Cold” and “Warm” should overlap. Why?
Real-world values often belong to more than one fuzzy set.
This enables smooth transitions in reasoning.

2. Use real-world intuition or data:


For temperature:
<15°C feels Cold

Around 22–25°C feels Warm

30°C feels Hot

Based on this, define:

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 19/42
Cold: (0, 15, 30)
Warm: (18, 25, 32)

Hot: (30, 36, 42)


3. Make sure full coverage of input domain:
Don’t leave any value “uncovered”

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.

🔍 Trick or Insight: Use Anchor Points


To assume parameters:

Start from a central anchor value (e.g., 25°C for “Warm”)


Spread equally or based on context:

±7 units → gives triangle (18, 25, 32)


Or ±5 → (20, 25, 30) for a narrower concept

🧠 Example Thought Process


Define “Warm” temperature

1. Fully Warm at 25°C → b = 25


2. Starts Warm around 18°C → a = 18
3. Too Hot above 32°C → c = 32

→ So: triangle (18, 25, 32)

🔷 In Summary:
Design Goal What You Do
Smooth transitions Overlap adjacent fuzzy sets

Human-like reasoning Use linguistic logic (cold, warm, hot)


Coverage of all inputs Ensure sets span the full input domain
Express vagueness Wider triangle = more uncertainty
Specificity Narrow triangle = precise concept

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.

🔷 Recap: Problem 4 – Heater Power Control


🔹 Fuzzy Input Variable: Temperature
Given:
Input temperature x = 20∘ C
Using triangular sets we defined earlier:

Fuzzy Set Triangle (a, b, c) μ(x) at 20°C


Cold (0, 15, 30) 0.667
Warm (18, 25, 32) 0.286
Hot (30, 36, 42) 0.000

🔹 Fuzzy Output Variable: Heater Power (in Watts)


Rule Condition Rule Output Crisp Value

If Temp is Cold High 3000


If Temp is Warm Medium 2000
If Temp is Hot Low 1000

So, based on fuzzy rules:

μCold = 0.667 → Heater Power = 3000


μWarm = 0.286 → Heater Power = 2000


μHot = 0 → Heater Power = 1000 (ignored in calculation)


🔷 Step-by-Step: Defuzzification Using Weighted Average


(Centroid Method)
Formula:

∑(μi ⋅ Outputi )
Crisp Output =
​ ​

∑ μi

Plug in the values:

(0.667 ⋅ 3000) + (0.286 ⋅ 2000)


Crisp Output =
0.667 + 0.286

🔸 Step-by-step Calculation:
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 21/42
Numerator = (2001) + (572) = 2573

Denominator = 0.667 + 0.286 = 0.953


2573
Output = ≈ 2701 Watts
0.953

✅ 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?

lets solve example on trapezoidal

Perfect! Let's now solve an example involving trapezoidal membership functions.

🔷 Problem 3 Recap: Fuzzification (Trapezoidal)


A trapezoidal membership function for “Medium Speed” is defined with parameters:
a = 10, b = 20, c = 30, d = 40

Find the membership value μ(x) for:

x = 15
x = 25
x = 35
x = 45

🔶 Step 1: Trapezoidal Membership Function Formula


⎧0, x ≤ a or x ≥ d

μ(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

🔶 Step 2: Apply to Each x


Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 22/42
🔹 x = 15
Range: 10 < x ≤ 20 → left slope
15 − 10 5
μ(15) = = = 0.5
20 − 10 10
​ ​

🔹 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?

also one example with fuzzification,defuzzication provide necessary data

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 1: Define Fuzzy Sets


🔸 Input Variable: Temperature (°C)
Fuzzy set: “Moderate” temperature → Trapezoidal

a = 18, b = 22, c = 26, d = 30

🔸 Output Variable: Fan Speed (RPM)


Based on fuzzy rules:

Temperature Condition Fan Speed (RPM)


Low 800
Moderate 1500
High 2500

We will only use Moderate for this example.

🔹 Step 2: Given Input


Let:

x = 24∘ C (current room temperature)

🔷 Step 3: Fuzzification
We compute μModerate (x) using trapezoidal rule.

Trapezoid parameters:

a = 18, b = 22, c = 26, d = 30

Range:

22 < x = 24 < 26 → flat top region ⇒ μ = 1

So,

μModerate (24) = 1.0


🔷 Step 4: Apply Rule


Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 24/42
If Temperature is Moderate → Fan Speed = 1500 RPM
So,

Rule fires with strength: 1.0


Output: 1500 RPM

🔷 Step 5: Defuzzification (Weighted Average)


Since only one rule fires, and μ = 1.0, the crisp output is:
1.0 ⋅ 1500
Fan Speed = = 1500 RPM
1.0

✅ 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.

🧼 Scenario: Washing Machine FIS


🔷 Goal:
Automatically determine Wash Time (minutes) based on:

Dirt Level (0 to 10)


Cloth Type (1 = delicate, 10 = rough)

🔹 Step 1: Define Input Variables and Fuzzy Sets


🟡 Input 1: Dirt Level (0–10)
Fuzzy Set Type Parameters
Low Triangular (0, 0, 5)
Medium Triangular (3, 5, 7)

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 25/42
Fuzzy Set Type Parameters
High Triangular (5, 10, 10)

🟡 Input 2: Cloth Type (1–10)


Fuzzy Set Type Parameters
Delicate Triangular (1, 1, 5)

Normal Triangular (3, 5, 7)


Rough Triangular (5, 10, 10)

🔹 Step 2: Define Output Variable: Wash Time (in minutes)


Range: 15 to 60 minutes

Fuzzy Set Crisp Output (Representative)

Short 20
Medium 40
Long 60

(We will use these crisp values in defuzzification.)

🔹 Step 3: Fuzzy Rules


Rule No. IF Dirt Level IS ... AND Cloth Type IS ... THEN Wash Time IS ...
R1 Low AND Delicate → Short
R2 Low AND Rough → Medium
R3 Medium AND Normal → Medium
R4 High AND Rough → Long
R5 High AND Delicate → Medium

🔹 Step 4: Given Inputs


Let’s assume:

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

✅ Dirt Level fuzzified as:


Medium: 0.5

High: 0.2

📌 For Cloth Type = 4:


Delicate → (1, 1, 5): 1 < 4 < 5 → descending slope
5−4 1
μ= 5−1 ​ = 4 ​ = 0.25
Normal → (3, 5, 7): 3 < 4 < 5 → ascending slope
4−3 1
μ= 5−3 ​ = 2 ​ = 0.5
Rough → (5, 10, 10): x =4<5→μ=0

✅ Cloth Type fuzzified as:


Delicate: 0.25
Normal: 0.5

🔷 Step 6: Rule Evaluation (Inference)


Let’s evaluate which rules fire and with what strength.
We use min operator for AND.

Rule Conditions Firing Strength Output

R3 Medium (0.5) AND Normal (0.5) min(0.5, 0.5) = 0.5 Medium


R5 High (0.2) AND Delicate (0.25) min(0.2, 0.25) = 0.2 Medium

Only these two rules are triggered.

🔷 Step 7: Defuzzification (Weighted Average)


Let:

Medium → 40 minutes

(0.5 ⋅ 40) + (0.2 ⋅ 40) 20 + 8 28


Wash Time = = = = 40 minutes
0.5 + 0.2 0.7 0.7
​ ​ ​

✅ Final Output: Wash Time = 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?

How did you decide on Rule Evaluation (Inference) ?

Great question! Let's break down how the rule evaluation (inference) is done in a fuzzy inference
system like this washing machine example.

🔷 What is Rule Evaluation?


In fuzzy logic, rule evaluation (inference) determines how strongly each fuzzy rule applies to the
current inputs. This is based on fuzzified membership values and logical operations (like AND, OR).
We’re typically using the Mamdani-style inference, where:

For “AND”, we use the minimum of the membership values.


For “OR”, we use the maximum of the membership values.
The output fuzzy set is scaled (clipped) by the result of the rule’s condition (its firing strength).

🔶 Example from Washing Machine Problem


🔸 Inputs:
Dirt Level = 6
Medium: 0.5
High: 0.2
Cloth Type = 4

Normal: 0.5
Delicate: 0.25

🔸 Rule Evaluation Logic:


Let’s look at Rule R3:

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:

μMedium Dirt = 0.5


μNormal Cloth = 0.5


We now apply the AND operator:

Firing strength = min(0.5, 0.5) = 0.5

So, this rule fires with strength 0.5, meaning 50% of the "Medium Wash Time" fuzzy set is active.

🔸 Another Example: Rule R5


IF Dirt Level is High AND Cloth Type is Delicate THEN Wash Time is Medium

We have:

μHigh Dirt = 0.2


μDelicate Cloth = 0.25


Then:

Firing strength = min(0.2, 0.25) = 0.2

So this rule contributes 20% strength to "Medium" Wash Time.

🔸 Why Use MIN?


Because in Mamdani inference:

AND = the rule only activates as strongly as its weakest condition.


This reflects real-world logic — if one input only slightly matches, it limits how strongly the rule
applies.

🔸 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)?

my question is why only R3 and R5 ?

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:

🔷 Step 1: Recall the Rules


Rule No. IF Dirt Level IS ... AND Cloth Type IS ... THEN Wash Time IS ...
R1 Low AND Delicate → Short

R2 Low AND Rough → Medium


R3 Medium AND Normal → Medium
R4 High AND Rough → Long
R5 High AND Delicate → Medium

🔷 Step 2: Recall the Fuzzified Inputs


You provided:

Dirt Level = 6
Cloth Type = 4

We fuzzified:

Dirt Level:

Low: 0 → because 6 is beyond the upper limit of the Low set.


Medium: 0.5
High: 0.2

Cloth Type:

Delicate: 0.25

Normal: 0.5
Rough: 0 → because 4 is below Rough’s lower boundary (which starts at 5)

🔷 Step 3: Evaluate Rule Applicability


Let’s check each rule:

🔹 R1: Low AND Delicate


μLow = 0, μDelicate = 0.25
​ ​

min(0, 0.25) = 0 ⇒ Rule does not fire

🔹 R2: Low AND Rough


Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 30/42
μLow = 0, μRough = 0
​ ​

min(0, 0) = 0 ⇒ Rule does not fire

🔹 R3: Medium AND Normal


μMedium = 0.5, μNormal = 0.5
​ ​

min(0.5, 0.5) = 0.5 ⇒ Rule fires

✅ Included
🔹 R4: High AND Rough
μHigh = 0.2, μRough = 0
​ ​

min(0.2, 0) = 0 ⇒ Rule does not fire

🔹 R5: High AND Delicate


μHigh = 0.2, μDelicate = 0.25
​ ​

min(0.2, 0.25) = 0.2 ⇒ Rule fires

✅ 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.

🌡️ Fuzzy Logic System: Temperature Control


🔷 Objective:
Automatically set fan speed (RPM) based on room temperature (°C) using fuzzy logic.

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:

Cold → Triangular (0, 0, 20)


Warm → Triangular (15, 25, 35)
Hot → Triangular (30, 40, 40)

🔵 Output: Fan Speed (RPM)


Range: 0 – 3000 RPM

Fuzzy Sets:
Low → Triangular (0, 0, 1500)
Medium → Triangular (1000, 2000, 3000)
High → Triangular (2000, 3000, 3000)

🔹 Step 2: Fuzzy Rule Base


Rule No. IF Temperature is ... THEN Fan Speed is ...
R1 Cold → Low
R2 Warm → Medium
R3 Hot → High

🔹 Step 3: Example Input


Let’s take:

Temperature = 28°C

🔹 Step 4: Fuzzification
Evaluate membership degrees at 28°C:

Cold (0, 0, 20): → 28 > 20 → μ =0


Warm (15, 25, 35): 25 < 28 < 35
35 − 28 7
μ= = = 0.7
35 − 25 10
​ ​

Hot (30, 40, 40): 28 < 30 → μ = 0


Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 32/42
✅ Fuzzified Inputs:
Warm: 0.7

🔹 Step 5: Rule Evaluation (Inference)


Only Rule R2 fires:

IF Temperature is Warm → Fan Speed is Medium


Firing strength: 0.7

🔹 Step 6: Defuzzification (Weighted Average or Centroid)


Assuming we use representative crisp values:

Low = 1000 RPM


Medium = 2000 RPM
High = 3000 RPM

Only Medium is active:

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

2. Hot → Triangular (30, 40, 40)


Starts at 30, peak at 40
Membership is:

⎧0 x ≤ 30
μHot (x) = ⎨ x−30 30 < x < 40

10
​ ​ ​ ​

1 x = 40

🔷 Step-by-Step Calculation at 30°C:


✅ For Warm:
25 < 30 < 35, so:

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:

Inputs: Traffic Density, Time of Day


Output: Signal Time (duration of green signal)

We'll go step by step: fuzzification → rules → inference → defuzzification.

🚦 Step 1: Define Input and Output Variables


🔹 Input 1: Traffic Density (cars per minute)
Range: 0 to 100

Low: Triangular (0, 0, 40)

Medium: Triangular (20, 50, 80)


High: Triangular (60, 100, 100)

🔹 Input 2: Time of Day (in 24-hour format)


Range: 0 to 24

Off-Peak: Triangular (0, 0, 10)

Normal: Triangular (8, 14, 20)


Peak: Triangular (17, 20, 24)

🔹 Output: Green Signal Time (seconds)


Range: 0 to 120

Short: Triangular (0, 0, 60)

Medium: Triangular (40, 60, 90)


Long: Triangular (80, 120, 120)

🚦 Step 2: Fuzzy Rule Base


Rule No. Traffic Density Time of Day Signal Time

R1 Low Off-Peak Short


R2 Low Peak Medium
R3 Medium Normal Medium
R4 High Peak Long
R5 High Off-Peak Medium

🚦 Step 3: Example Input


Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 35/42
Suppose we have:

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
​ ​

High: Between 60–100

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
​ ​

Peak: Between 17–20

18 − 17 1
μ= = ≈ 0.33
20 − 17 3
​ ​

✅ Result:
Normal = 0.33

Peak = 0.33

🚦 Step 5: Rule Evaluation


Now evaluate applicable rules using min(traffic, time):

R3 (Medium, Normal): min(0.33, 0.33) = 0.33 → Medium Signal

R4 (High, Peak): min(0.25, 0.33) = 0.25 → Long Signal

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 36/42
Only these rules apply due to non-zero membership.

🚦 Step 6: Defuzzification (Weighted Average)


Let’s use representative crisp values:

Medium = 65 sec
Long = 100 sec

(0.33 ⋅ 65) + (0.25 ⋅ 100) 21.45 + 25 46.45


Output = = ≈ ≈ 80.1 seconds
0.33 + 0.25 0.58 0.58
​ ​ ​

✅ 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

Person's height: 180 cm


Membership function value at 180 cm: μₜₐₗₗ(180) = 0.8

🔹 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)

🚰 Step 1: Define Linguistic Variables


🔹 Input 1: Inflow Rate (0 to 100 L/min)
Fuzzy sets:

Low → Triangular (0, 0, 50)


Medium → Triangular (25, 50, 75)
High → Triangular (50, 100, 100)

🔹 Input 2: Outflow Rate (0 to 100 L/min)


Fuzzy sets:

Low → Triangular (0, 0, 40)


Medium → Triangular (20, 50, 80)
High → Triangular (60, 100, 100)

🔹 Output: Water Level (0% to 100%)


Fuzzy sets:

Low → Triangular (0, 0, 40)


Medium → Triangular (30, 50, 70)
High → Triangular (60, 100, 100)

🔧 Step 2: Fuzzy Rule Base


| Rule No. | IF Inflow IS ... AND Outflow IS ... THEN Water Level IS ... |
|----------|---------------------------|---------------------------|------------------|
| R1 | Low | High | Low |
| R2 | High | Low | High |
| R3 | Medium | Medium | Medium |
| R4 | High | High | Medium |

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 |

📊 Step 3: Sample Membership Functions (Text Format)


Inflow (x-axis: L/min)

markdown

/\
/ \
/ \
____/ \________
0 25 50 75 100

Low: peak at 0
Medium: peak at 50
High: peak at 100

Outflow – Similar pattern

Water Level (0–100%)

markdown

/\
/ \
/ \
____/ \________
0 30 50 70 100

🔍 Step 4: Example Input


Suppose:

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

Great! Let’s go step by step to compute the water level for:

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:

Medium (25, 50, 75):

75 − 60 15
μMedium (60) = = = 0.6
75 − 50 25
​ ​ ​

High (50, 100, 100):

60 − 50 10
μHigh (60) = = = 0.2
100 − 50 50
​ ​ ​

✅ Inflow memberships:
Medium = 0.6
High = 0.2

📤 Outflow = 30
Membership in:

Low (0, 0, 40):

40 − 30 10
μLow (30) = = = 0.25
40 − 0 40
​ ​ ​

Medium (20, 50, 80):

30 − 20 10
μMedium (30) = = ≈ 0.33
50 − 20 30
​ ​ ​

✅ Outflow memberships:
Low = 0.25

Medium = 0.33

🔹 Step 2: Rule Evaluation


We use `min` operator for AND. Evaluate each rule that has matching non-zero memberships.

🔸 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

So two rules suggest High, and one suggests Medium.

🔹 Step 3: Defuzzification (Weighted Average Method)


Let’s assign representative crisp values:

High = 90%
Medium = 50%

Now compute:

(0.2 ⋅ 90) + (0.33 ⋅ 50) + (0.25 ⋅ 90)


Water Level =
0.2 + 0.33 + 0.25

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?

the output should be crisp? then why?

Output: Water Level (0% to 100%)


Fuzzy sets:

Low → Triangular (0, 0, 40)

Medium → Triangular (30, 50, 70)

High → Triangular (60, 100, 100)

Excellent question — you're touching on an important concept in fuzzy logic systems.


Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 41/42
🔹 Why Is the Output Crisp?
Yes, in most real-world fuzzy systems, the final output must be crisp (a single value), because
actuators or systems can't work with fuzzy sets. They need precise instructions. For example:

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.

🔹 Then Why Define Fuzzy Sets for Output?


Fuzzy sets like:

Low → Triangular (0, 0, 40)


Medium → Triangular (30, 50, 70)
High → Triangular (60, 100, 100)

...are used during the inference stage. Here's how:

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%).

🔁 Summary of the Process:


1. Inputs → fuzzified → degrees of membership in fuzzy sets

2. Rules → activate fuzzy output sets


3. Output fuzzy sets → combined
4. Defuzzification → crisp output (used for control)

⚠️ Without fuzzy output sets:


You couldn't model gradual transitions or partial truth, which is the core of fuzzy logic.

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

You might also like