# FUZZY LOGIC

T.C.Kanish Assistant Professor (Sr.) VIT University

OVERVIEW
What is Fuzzy Logic? Where did it begin? What is MatLab Fuzzy Logic Toolbox For? Fuzzy Logic in Control Systems Overview: Fuzzy Inference Systems Fuzzy Set Concept Fuzzy Rules Membership functions How it works Building Systems: An Example Demo Discussion

WHAT IS FUZZY LOGIC?
Definition of fuzzy
Fuzzy – “not clear, distinct, or precise; blurred”

Definition of fuzzy logic
A form of knowledge representation suitable for notions that cannot be defined precisely, but which depend upon their contexts.

FUZZY LOGIC

“As complexity rises, precise statements lose meaning and meaningful statements lose precision” - Lotfi Zadeh

FUZZY LOGIC COME FROM
Concept of Fuzzy Logic (FL) was conceived by Lotfi Zadeh, a professor at the University of California at Berkley, and presented not as a control methodology, But as a way of processing data by allowing partial set membership rather than crisp set membership or nonmembership This approach to set theory was not applied to control systems until the 70's due to insufficient small-computer capability prior to that time.

ORIGINS OF FUZZY LOGIC
First to publish ideas of fuzzy logic.

Professor Toshire Terano ( 1972 )
Organized the world's first working group on fuzzy systems.

F.L. Smidth & Co. ( 1980 )
First to market fuzzy expert systems.

FUZZY LOGIC
FL is a problem-solving control system methodology that lends itself to implementation in systems ranging from simple, small, embedded microcontrollers to large, networked, multi-channel PC or workstation-based data acquisition and control systems. It can be implemented in hardware, software, or a combination of both. FL provides a simple way to arrive at a definite conclusion based upon vague, ambiguous, imprecise, noisy, or missing input information. FL's approach to control problems mimics how a person would make decisions, only much faster.

FUZZY LOGIC (Cont..)
Fuzzy logic provides a method to formalize reasoning when dealing with vague terms. Traditional computing requires finite precision which is not always possible in real world scenarios. Not every decision is either true or false, or as with Boolean logic either 0 or 1. Fuzzy logic allows for membership functions, or degrees of truthfulness and falsehoods. or as with Boolean logic, not only 0 and 1 but all the numbers that fall in between.

Slow
Speed = 0

Fast
Speed = 1

bool speed; get the speed if ( speed == 0) { // speed is slow } else { // speed is fast }

FUZZY LOGIC REPRESENTATION
For every problem must represent in terms of fuzzy sets. Slowest
[ 0.0 – 0.25 ]

Slow
[ 0.25 – 0.50 ]

Fast
[ 0.50 – 0.75 ]

Fastest
[ 0.75 – 1.00 ]

FUZZY LOGIC REPRESENTATION CONT.

Slowest

Slow

Fast

Fastest

float speed; get the speed if ((speed >= 0.0)&&(speed < 0.25)) { // speed is slowest } else if ((speed >= 0.25)&&(speed < 0.5)) { // speed is slow } else if ((speed >= 0.5)&&(speed < 0.75)) { // speed is fast } else // speed >= 0.75 && speed < 1.0 { // speed is fastest }

FUZZY MATHEMATICS
Fuzzy Numbers – almost 5, or more than 50 Fuzzy Geometry – Almost Straight Lines Fuzzy Algebra – Not quite a parabola Fuzzy Calculus Fuzzy Graphs – based on fuzzy points

FUZZY LOGIC VS. NEURAL NETWORKS
How does a Neural Network work? Both model the human brain.
Fuzzy Logic Neural Networks

Both used to create behavioral systems.

FUZZY OPERATIONS

A

B

A∧B

A∨B

¬A

CONTROLLER STRUCTURE
Fuzzification
Scales and maps input variables to fuzzy sets

Inference Mechanism
Approximate reasoning Deduces the control action

Defuzzification
Convert fuzzy output values to control signals

SIMPLE FUZZY CONTROLLER

FUZZY LOGIC IN CONTROL SYSTEMS
Fuzzy Logic provides a more efficient and resourceful way to solve Control Systems. Some Examples
Temperature Controller Anti – Lock Break System ( ABS )

SIMPLE TEMPARTURE CONTROL

Fuzzy based Temperature controller

RULE BASE
Air Temperature Set cold {50, 0, 0} Set cool {65, 55, 45} Set just right {70, 65, 60} Set warm {85, 75, 65} Set hot {∞, 90, 80}

Fan Speed o o o o o Set stop {0, 0, 0} Set slow {50, 30, 10} Set medium {60, 50, 40} Set fast {90, 70, 50} Set blast {∞, 100, 80}

RULES
Air Conditioning Controller Example: IF Cold then Stop If Cool then Slow If OK then Medium If Warm then Fast IF Hot then Blast

FUZZY AIR CONDITIONER
0 100 90 80 70 60 50 40 30 20 10 0 if Cold then Stop
op St
Med ium
Bl a st

If Hot then Blast If Warm then Fast

Fa st

If Just Right then Medium IF Cool then Slow

Sl ow

1
ar m Co ol W Ho t

0 45 50 55 60 65 70 75 80 85 90

Jus Rig t ht

ld Co

MAPPING INPUTS TO OUTPUTS
1 0 100 90 80 70 60
Med
st Bla

t

Fa st

50 40 30 20 10 0

ium

Sl ow

ar m

Co ol

0 45 50 55 60 65 70 75 80 85 90

Jus Rig t ht

W

Ho t

op St

1

ld Co

TEMPERATURE CONTROLLER
The problem
Change the speed of a heater fan, based off the room temperature and humidity.

A temperature control system has four settings
Cold, Cool, Warm, and Hot

Humidity can be defined by:
Low, Medium, and High

Using this we can define the fuzzy set.

BENEFITS OF USING FUZZY LOGIC

ANTI LOCK BREAK SYSTEM ( ABS )
Nonlinear and dynamic in nature Inputs for Intel Fuzzy ABS are derived from
Brake 4 WD Feedback Wheel speed Ignition

Outputs
Pulsewidth Error lamp

FUZZY LOGIC IN OTHER FIELDS

FUZZY LOGIC USING MATLAB

PRIMARY GUI Tools
We can use five primary GUI tools for building, editing, and observing fuzzy inference systems in the toolbox Fuzzy Inference System (FIS) Editor Membership Function Editor Rule Editor Rule Viewer Surface Viewer

PRIMARY GUI TOOLS

User Interface Layout: Getting Started

User Interface Layout: FIS Editor

UI Layout: MF Editor - Service

UI LAYOUT: MF EDITOR -FOOD

UI Layout: MF Editor - Tip

User Interface Layout: Rule Editor

User Interface Layout: Rule Viewer

User Interface Layout: Surface Viewer

CONCLUSION
Fuzzy logic provides an alternative way to represent linguistic and subjective attributes of the real world in computing. It is able to be applied to control systems and other applications in order to improve the efficiency and simplicity of the design process.