0% found this document useful (0 votes)
7 views

Soft computing

Fuzzy logic is a soft computing concept that allows reasoning with degrees of truth, enabling decision-making under uncertainty. It utilizes fuzzy sets and membership functions to handle vagueness, with applications in various fields such as automation, medical diagnosis, and self-driving cars. The document also covers operations on fuzzy sets, fuzzy rules, and defuzzification techniques to convert fuzzy outputs into crisp values.

Uploaded by

mriya4740
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)
7 views

Soft computing

Fuzzy logic is a soft computing concept that allows reasoning with degrees of truth, enabling decision-making under uncertainty. It utilizes fuzzy sets and membership functions to handle vagueness, with applications in various fields such as automation, medical diagnosis, and self-driving cars. The document also covers operations on fuzzy sets, fuzzy rules, and defuzzification techniques to convert fuzzy outputs into crisp values.

Uploaded by

mriya4740
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/ 17

A.

Basics of Fuzzy Logic


Fuzzy logic is a fundamental concept in soft computing that allows reasoning with imprecise,
uncertain, or vague information, similar to how humans make decisions in real life. Unlike
classical logic, which strictly follows binary values (True/False, 1/0), fuzzy logic deals with
degrees of truth.

1. Introduction to Fuzzy Logic


1.1 What is Fuzzy Logic?
Fuzzy logic is an extension of classical Boolean logic that allows handling partial truth
values between 0 and 1. Instead of a strict "True or False" approach, fuzzy logic introduces a
range of values, allowing for reasoning like:

●​ "The weather is somewhat hot."


●​ "The car is moderately fast."

Key Differences: Classical vs. Fuzzy Logic


Feature Classical Logic (Boolean Logic) Fuzzy Logic

Truth Values Only 0 (False) or 1 (True) Continuous values between 0


and 1

Decision Making Strict rules Flexible, human-like reasoning

Example "Temperature > 30°C = HOT, else "Temperature at 28°C is


COLD" partially hot"

Handling No Yes, can handle vagueness


Uncertainty

1.2 Why Fuzzy Logic?

Fuzzy logic is widely used in applications where decision-making is uncertain or


approximate. Some real-world scenarios include:
●​ Washing Machines: Adjusting wash time based on dirtiness of clothes.
●​ Air Conditioners: Setting temperature based on comfort levels rather than exact
values.
●​ Medical Diagnosis: "Patient has a high chance of having diabetes."
●​ Self-Driving Cars: Evaluating traffic conditions, pedestrian movement, and
decision-making.

2. Fuzzy Sets and Membership Functions


2.1 What are Fuzzy Sets?
A fuzzy set is a set where elements have degrees of membership between 0 and 1. This
differs from crisp sets, where elements belong completely (1) or not at all (0).

Example: Defining "Tall People"

●​ Crisp Set: A person is "Tall" if height ≥ 180 cm, else "Not Tall".
○​ H={180,185,190,195}H = \{180, 185, 190, 195\}
●​ Fuzzy Set: A person is "Tall" with varying degrees of membership:
○​ H={(160,0.2),(170,0.5),(180,0.8),(190,1.0)}H = \{ (160, 0.2), (170, 0.5), (180, 0.8),
(190, 1.0) \}

In a fuzzy set, a person who is 170 cm tall may be considered "partially tall" with a
membership value of 0.5, rather than being strictly "tall" or "not tall".

2.2 Membership Functions


A Membership Function (MF) defines the degree to which an element belongs to a fuzzy set. It
maps input values to membership values (0 to 1).

Types of Membership Functions

1.​ Triangular Membership Function​

○​ Simple and widely used in fuzzy logic.


○​ Defined by three points: (a,b,c)(a, b, c).
○​ Example: Membership function for "Medium Temperature": μMedium(x)={0,x<a
or x>cx−ab−a,a≤x≤bc−xc−b,b≤x≤c\mu_{\text{Medium}}(x) = \begin{cases} 0, & x
< a \text{ or } x > c \\ \frac{x-a}{b-a}, & a \leq x \leq b \\ \frac{c-x}{c-b}, & b \leq x
\leq c \end{cases}
○​ If "Medium Temperature" is defined as (15°C, 25°C, 35°C):
■​ 10°C → μ=0\mu = 0
■​ 25°C → μ=1\mu = 1
■​ 30°C → μ=0.5\mu = 0.5
2.​ Trapezoidal Membership Function​

○​ Similar to a triangular MF but with a flat top.


○​ Used for gradual transitions between fuzzy states.
○​ Defined by four points: (a,b,c,d)(a, b, c, d).
○​ Example: "Comfortable Temperature" defined as (18°C, 22°C, 28°C, 32°C).
3.​ Gaussian Membership Function​

○​ Uses a bell-shaped curve for smooth transitions.


○​ Formula: μ(x)=e−(x−c)22σ2\mu(x) = e^{-\frac{(x-c)^2}{2\sigma^2}}
○​ Example: Used in image processing and control systems for smooth
decision-making.
4.​ Sigmoidal Membership Function​

○​ Uses a S-shaped curve to model binary decisions with gradual transitions.


○​ Example: Medical diagnosis systems where symptoms gradually indicate
disease probability.

2.3 Example: Fuzzy Logic in Action


Problem: Determining Fan Speed Based on Temperature

Consider a fuzzy logic system that controls a fan’s speed based on temperature.

1.​ Define Fuzzy Sets:​

○​ Low Temperature (0°C - 20°C)


○​ Medium Temperature (15°C - 30°C)
○​ High Temperature (25°C - 40°C)
2.​ Assign Membership Functions:​

○​ A temperature of 18°C might belong to both "Low" (0.7) and "Medium" (0.3).
○​ A temperature of 28°C might belong to both "Medium" (0.6) and "High" (0.4).
3.​ Decision Making (Fuzzy Inference System - FIS):​

○​ If temperature is "Low", set fan speed to Slow.


○​ If temperature is "Medium", set fan speed to Moderate.
○​ If temperature is "High", set fan speed to Fast.
4.​ Defuzzification (Convert Fuzzy to Crisp Value):​

○​ If temperature = 25°C, the system calculates fan speed as moderate (60%) and
fast (40%), leading to a final speed of 70% rotation speed.

3. Applications of Fuzzy Sets and Membership Functions


Application Usage

Consumer Washing machines adjust time based on dirt


Electronics level

Air Conditioners Adjust cooling levels based on comfort

Medical Diagnosis Predicts disease likelihood based on symptoms

Stock Market Determines market trends with uncertain data

Self-Driving Cars Evaluates speed based on fuzzy traffic data

Final Summary
Topic Key Takeaways

Fuzzy Logic Handles uncertainty with degrees of truth

Fuzzy Sets Elements belong with varying membership


values

Membership Convert input data into fuzzy values


Functions

Real-World Use AI, automation, robotics, healthcare

B. Operations & Inference in Fuzzy Logic


Fuzzy logic extends classical set operations to handle uncertainty and vagueness. This unit
covers the fundamental operations on fuzzy sets, how fuzzy sets relate to each other (fuzzy
relations), and how fuzzy logic is used for decision-making through rules, propositions,
implications, and inferences.

1. Operations on Fuzzy Sets


Fuzzy set operations are similar to classical set operations but use membership functions (μ)
instead of strict inclusion/exclusion.

1.1. Basic Operations on Fuzzy Sets


Let A and B be two fuzzy sets with membership functions μ_A(x) and μ_B(x).

1.1.1. Union (OR Operation - Maximum)

●​ Definition: The union of two fuzzy sets A ∪ B is computed using the maximum of their
membership functions.
●​ Formula: μA∪B(x)=max⁡(μA(x),μB(x))\mu_{A \cup B}(x) = \max (\mu_A(x), \mu_B(x))
●​ Example:​
Let fuzzy sets be:
○​ A (Tall People): μ_A(170) = 0.5, μ_A(180) = 0.8
○​ B (Heavy People): μ_B(170) = 0.6, μ_B(180) = 0.7
○​ A ∪ B (Tall OR Heavy People):
■​ μ_A∪B(170) = max(0.5, 0.6) = 0.6
■​ μ_A∪B(180) = max(0.8, 0.7) = 0.8

1.1.2. Intersection (AND Operation - Minimum)

●​ Definition: The intersection of two fuzzy sets A ∩ B is computed using the minimum of
their membership functions.
●​ Formula: μA∩B(x)=min⁡(μA(x),μB(x))\mu_{A \cap B}(x) = \min (\mu_A(x), \mu_B(x))
●​ Example:
○​ A ∩ B (Tall AND Heavy People):
■​ μ_A∩B(170) = min(0.5, 0.6) = 0.5
■​ μ_A∩B(180) = min(0.8, 0.7) = 0.7

1.1.3. Complement (NOT Operation - Negation)


●​ Definition: The complement of a fuzzy set A' is computed as 1 minus the membership
function.
●​ Formula: μA′(x)=1−μA(x)\mu_{A'}(x) = 1 - \mu_A(x)
●​ Example:
○​ If μ_A(170) = 0.5, then μ_A'(170) = 1 - 0.5 = 0.5 (not tall).

2. Fuzzy Relations
A fuzzy relation describes how two fuzzy sets are connected. It extends the concept of
classical relations by allowing partial membership instead of strict relationships.

2.1. Cartesian Product of Fuzzy Sets


Given two fuzzy sets A and B, the Cartesian product defines a fuzzy relation R between them:

R(A,B)=A×BR(A, B) = A \times B

●​ If A = {Young, Middle-Aged, Old}


●​ And B = {Low Salary, Medium Salary, High Salary}
●​ Then, a fuzzy relation could express how age is associated with salary.

Example:

Age → Salary Low Salary Medium Salary High Salary

Young (0.8) 0.9 0.4 0.1

Middle (0.6) 0.5 0.7 0.3

Old (0.2) 0.1 0.3 0.9

Here, a young person has a high membership (0.9) in the low salary category.

3. Fuzzy Rules, Propositions, Implications,


and Inference
Fuzzy decision-making uses fuzzy rules and inferences to approximate human-like
reasoning.

3.1. Fuzzy Rules


Fuzzy rules are if-then statements that describe the relationship between input and output.

General form of a fuzzy rule:

IF (condition) THEN (consequence)\text{IF (condition) THEN (consequence)}

●​ Example 1 (Fan Speed Control)​

○​ IF Temperature is High, THEN Fan Speed is Fast


○​ IF Temperature is Medium, THEN Fan Speed is Moderate
●​ Example 2 (Medical Diagnosis)​

○​ IF Fever is High AND Cough is Severe, THEN Likelihood of Flu is High

3.1.1. Rule Base

A collection of fuzzy rules is called a Rule Base or Fuzzy Rule Set.

Condition Action

IF Temperature is Low THEN Fan Speed is Slow

IF Temperature is Medium THEN Fan Speed is Medium

IF Temperature is High THEN Fan Speed is Fast

3.2. Fuzzy Propositions


A fuzzy proposition is a statement with a degree of truth.

Proposition Truth Value

"The weather is hot" 0.8

"The car is fast" 0.6

Unlike classical logic (which is true or false), fuzzy propositions assign partial truth values.
3.3. Fuzzy Implications
Fuzzy implications define how the truth of one fuzzy statement affects another.

3.3.1. Mamdani Implication

●​ Uses minimum operation for "AND" and maximum operation for "OR".
●​ Example:
○​ IF Humidity is High (0.8) AND Temperature is Hot (0.7),
○​ THEN Air Conditioner Power = min(0.8, 0.7) = 0.7.

3.3.2. Sugeno Implication

●​ Uses mathematical functions instead of membership values.


●​ Example:
○​ IF Traffic is Heavy, THEN Travel Time = (Base Time × 2).

3.4. Fuzzy Inference System (FIS)


A Fuzzy Inference System (FIS) is a system that processes inputs, applies fuzzy rules, and
produces an output.

3.4.1. Steps in Fuzzy Inference Process

1.​ Fuzzification – Convert crisp inputs into fuzzy values.


○​ Example: Convert Temperature = 28°C into "Medium Temperature" with
membership 0.6.
2.​ Rule Evaluation – Apply fuzzy rules.
3.​ Aggregation – Combine results from all rules.
4.​ Defuzzification – Convert fuzzy output into a crisp value.

Example: Fuzzy Logic for Washing


Machine Control
1.​ Inputs:​

○​ Dirt Level (Low, Medium, High)


○​ Load Weight (Light, Normal, Heavy)
2.​ Fuzzy Rule Base:​

Dirt Level Load Weight Wash Time

Low Light Short

High Heavy Long

3.​ ​
Inference System Execution:​

○​ IF Dirt Level is High (0.8) AND Load Weight is Heavy (0.7),


○​ THEN Wash Time is Long (min(0.8, 0.7) = 0.7).
4.​ Defuzzification:​

○​ Converts "Long (0.7)" into a crisp time of 45 minutes.

Final Summary
Concept Key Takeaway

Fuzzy Set Operations Extends classical logic using max/min


values

Fuzzy Relations Describes fuzzy relationships between sets

Fuzzy Rules & Inference Uses "IF-THEN" logic for decision making

Applications Used in AI, robotics, medical diagnosis

C. Applications & Design of Fuzzy Logic


Fuzzy logic is widely used in real-world applications such as control systems, automation,
decision-making, and AI. However, since fuzzy logic deals with degrees of truth (0 to 1), we
often need to convert fuzzy outputs back into crisp values using defuzzification
techniques.

1. Defuzzification Techniques
1.1 What is Defuzzification?
Defuzzification is the process of converting fuzzy output (membership values between 0
and 1) into a single crisp value. Since fuzzy logic systems process information in a fuzzy
manner, we need to extract precise numerical values for real-world use.

1.2 Need for Defuzzification

●​ Machines and actuators require crisp values (e.g., fan speed must be set to a
specific RPM).
●​ Humans need precise decisions (e.g., "Set AC to 25°C, not 'somewhat cool'").
●​ Bridges the gap between fuzzy logic and real-world applications.

1.3 Common Defuzzification Methods


Method Formula/Approach Usage

1. Centroid Method ∑(μi×xi)∑μi\frac{\sum (\mu_i Most widely used, calculates


(COG - Center of \times x_i)}{\sum \mu_i} center of mass
Gravity)

2. Bisector Method Splits the fuzzy area into two Used when COG is too
equal halves computationally expensive

3. Mean of Maximum Averages the highest Fast and simple


(MoM) membership values

4. Largest of Maximum Takes largest x-value where Used when preference is for
(LoM) membership is max larger outputs

5. Smallest of Maximum Takes smallest x-value where Used when preference is for
(SoM) membership is max smaller outputs
Example: Defuzzification of Fan Speed

Consider a fuzzy output where:

●​ Slow (membership = 0.3, speed = 10 RPM)


●​ Medium (membership = 0.8, speed = 50 RPM)
●​ Fast (membership = 0.4, speed = 80 RPM)

Using Centroid Method (COG):

Speed=(10×0.3)+(50×0.8)+(80×0.4)(0.3+0.8+0.4)Speed = \frac{(10 \times 0.3) + (50 \times 0.8)


+ (80 \times 0.4)}{(0.3 + 0.8 + 0.4)} =(3+40+32)1.5=751.5=50RPM= \frac{(3 + 40 + 32)}{1.5} =
\frac{75}{1.5} = 50 RPM

Thus, the final fan speed is set to 50 RPM.

2. Fuzzy Logic Controller (FLC) Design


2.1 What is a Fuzzy Logic Controller (FLC)?
A Fuzzy Logic Controller (FLC) is a system that controls devices or processes using fuzzy
logic instead of traditional precise algorithms.

2.2 Components of a Fuzzy Logic Controller

A Fuzzy Logic Controller (FLC) consists of four main components:

Component Function Example

1. Fuzzification Converts crisp inputs into Convert temperature = 28°C into


Module fuzzy values "Warm" (0.6) and "Hot" (0.3)

2. Rule Base Set of if-then rules defining "IF temperature is Hot, THEN fan
(Knowledge Base) system behavior speed is High"

3. Inference Engine Applies fuzzy rules to Determines Fan Speed = Medium


determine output fuzzy (0.7) and High (0.3)
values

4. Defuzzification Converts fuzzy output into a Final Fan Speed = 50 RPM


Module crisp value
2.3 Steps to Design a Fuzzy Logic Controller
Step 1: Define Inputs and Outputs

●​ Inputs: Temperature (°C), Humidity (%)


●​ Outputs: Fan Speed (RPM)

Step 2: Define Fuzzy Sets and Membership Functions

●​ Temperature Fuzzy Sets: Cold (0-20°C), Warm (15-30°C), Hot (25-40°C)


●​ Fan Speed Fuzzy Sets: Slow (0-30 RPM), Medium (20-70 RPM), Fast (50-100 RPM)

Step 3: Define Fuzzy Rules


Rule IF Condition THEN Action

1 Temperature is Cold Fan Speed is Slow

2 Temperature is Warm Fan Speed is


Medium

3 Temperature is Hot Fan Speed is Fast

Step 4: Apply Fuzzy Inference

●​ Example: If Temperature = 28°C, it belongs 60% to Warm and 40% to Hot.


●​ Fuzzy Output: Fan Speed = Medium (60%) and Fast (40%).

Step 5: Apply Defuzzification

●​ Compute final fan speed using Centroid Method.

Step 6: Implement the Controller

●​ Use microcontrollers, software, or AI to automate the fuzzy logic system.

3. Real-Life Applications of Fuzzy Logic


Fuzzy logic is widely used in control systems, decision-making, and artificial intelligence
applications.

3.1 Consumer Electronics


Application How Fuzzy Logic is Used

Washing Adjusts wash time based on dirtiness & load weight


Machines

Air Conditioners Adjusts cooling intensity based on temperature &


humidity

Refrigerators Controls defrosting cycle based on usage patterns

3.2 Automotive Industry


Application How Fuzzy Logic is Used

Anti-lock Braking System (ABS) Adjusts braking force based on road conditions

Self-Driving Cars Evaluates traffic, pedestrian movement, and


speed

Fuel Efficiency Systems Optimizes fuel consumption using driving behavior

3.3 Healthcare & Medical Diagnosis


Application How Fuzzy Logic is Used

Disease Diagnosis Analyzes symptoms to determine probability of


illness

Medical Image Processing Enhances X-rays and MRI images

Pacemakers & Life Support Adjusts heart pacing based on patient conditions

3.4 Industrial & Robotics


Application How Fuzzy Logic is Used
Industrial Automation Controls machinery & production speed

Robotic Motion Control Adjusts grip strength & movement speed

Smart Traffic Systems Adjusts signal timing based on traffic


flow

Final Summary
Concept Key Takeaways

Defuzzification Converts fuzzy values into crisp outputs

Fuzzy Logic Controller (FLC) A system that makes decisions based on fuzzy
rules

Applications Used in electronics, healthcare, cars, and robotics

Summary of Unit 2: Fuzzy Logic


Unit 2 focuses on Fuzzy Logic, which is an extension of classical Boolean logic that deals with
degrees of truth rather than strict binary values. It enables systems to handle uncertainty,
imprecision, and vagueness, making it useful in AI, automation, and decision-making.

1. Basics of Fuzzy Logic


1.1 Introduction to Fuzzy Logic

●​ Fuzzy logic extends classical logic by allowing values between 0 and 1, rather than just
True (1) or False (0).
●​ It mimics human reasoning in situations where decisions are not purely black or white.
●​ Example: Instead of defining "Tall" as height > 180 cm, fuzzy logic allows partial
membership (e.g., 175 cm is 0.7 "Tall").

1.2 Fuzzy Sets & Membership Functions


●​ Fuzzy Sets allow partial membership in a group.
○​ Example: A person who is 175 cm tall may be 70% Tall rather than strictly "Tall"
or "Not Tall".
●​ Membership Functions (MFs) determine the degree of belonging to a fuzzy set.
○​ Common MFs:
■​ Triangular MF (simple and widely used)
■​ Trapezoidal MF (used for gradual transitions)
■​ Gaussian MF (smooth curves for AI applications)
■​ Sigmoid MF (used for binary decisions with soft transitions)

2. Operations on Fuzzy Sets & Fuzzy Inference


2.1 Operations on Fuzzy Sets

Fuzzy logic extends classical set operations:

Operation Formula Example

Union (OR) μA∪B(x)=max⁡(μA(x),μB(x))\mu The "Tall OR Heavy" set takes the


_{A \cup B}(x) = \max highest membership values
(\mu_A(x), \mu_B(x))

Intersection μA∩B(x)=min⁡(μA(x),μB(x))\mu_ The "Tall AND Heavy" set takes the


(AND) {A \cap B}(x) = \min (\mu_A(x), lowest membership values
\mu_B(x))

Complement μA′(x)=1−μA(x)\mu_{A'}(x) = 1 - The opposite of a fuzzy set


(NOT) \mu_A(x)

2.2 Fuzzy Relations & Fuzzy Rule Base

●​ Fuzzy Relations describe how two fuzzy sets are connected.


●​ Fuzzy Rules use IF-THEN logic to define decision-making.
○​ Example: "IF temperature is high, THEN fan speed is fast."

2.3 Fuzzy Inference System (FIS)

A Fuzzy Inference System (FIS) processes fuzzy inputs and generates a decision.

1.​ Fuzzification – Convert crisp inputs into fuzzy values.


2.​ Rule Evaluation – Apply fuzzy rules.
3.​ Aggregation – Combine the results from multiple rules.
4.​ Defuzzification – Convert fuzzy output into a crisp value.

3. Applications & Design of Fuzzy Logic


3.1 Defuzzification Techniques

Since fuzzy logic produces fuzzy outputs, defuzzification converts them into crisp values for
practical use.

Defuzzification Method Approach Usage

Centroid Method (COG) Computes center of gravity Most common, used in AI &
robotics

Mean of Maximum Averages the highest Used when output must be in


(MoM) membership values the middle

Largest of Maximum Takes largest x-value with max Used when higher values
(LoM) membership are preferred

Smallest of Maximum Takes smallest x-value with max Used when lower values are
(SoM) membership preferred

3.2 Fuzzy Logic Controller (FLC) Design

A Fuzzy Logic Controller (FLC) automates decision-making based on fuzzy rules.​


Steps to Design an FLC:

1.​ Define inputs (e.g., temperature, humidity) and outputs (e.g., fan speed).
2.​ Define fuzzy sets and membership functions.
3.​ Create a rule base (e.g., "IF temperature is High, THEN fan speed is Fast").
4.​ Use fuzzy inference to process inputs.
5.​ Apply defuzzification to generate a crisp output.

3.3 Real-World Applications of Fuzzy Logic


Industry Application

Consumer Washing machines, air conditioners, refrigerators


Electronics

Automotive Anti-lock braking system (ABS), self-driving cars, fuel efficiency


Healthcare Disease diagnosis, medical image processing, pacemakers

Industrial Automation Robotic motion control, smart traffic systems

Final Summary
Concept Key Takeaways

Fuzzy Logic Allows reasoning with imprecise and uncertain data

Fuzzy Sets Membership values range between 0 and 1, rather than strict True/False

Fuzzy Inference Uses IF-THEN rules to process fuzzy data and make decisions

Defuzzification Converts fuzzy values into precise outputs for real-world use

Applications Used in AI, robotics, healthcare, automation, and consumer


electronics

Conclusion
Fuzzy logic enables intelligent decision-making in systems where data is uncertain or
imprecise. It is widely applied in AI, automation, medical diagnosis, control systems, and
robotics, making it a crucial part of soft computing.

Would you like examples or a practice problem to solidify your understanding? 😊

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy