Fuzzy Logic- Introduction and Implementation


Founded by Lotfi A Zadeh in 1965, Fuzzy Logic was first implemented in steam engine speed control.

So what actually is Fuzzy Logic?

It is considered an extension of Boolean logic and a logic that handles the concept of partial truth. The range of truth value is between yes and no. It can be certainly yes, slightly yes, no, strictly no or anything and these are the terms under fuzzy set. It mimics the human reasoning about things. Like  if we ask someone, “hows the weather today?”, different people may have different answers. One may say “Its hot”, another may say “Its too hot” , some may say “Its normal” or someone living in Solukhumbu may say “Its too cold”.  The logic always represents vagueness.

Also according to Zadeh, the logic involves computing using words as linguistic variables. Any linguistic variable can be represented as <x,T(x),U,G,M> where
x=linguistic variable, T(x)=set of terms, U=universe of discourse, G=  syntax rules, M= semantic rules.

Linguistic Variables

Linguistic variables are those variables whose values are not number but words or sentences. Fuzzy logic bridges between these words and numbers.

e.g. temperature is a linguistic variable and set of terms=(too cold, cold, warm, hot, too hot). These terms are mapped to numerical values using membership functions.

3 centigrade temperature here represents cold or too cold and their membership is between 0 to 1 where U=[-10,40].

Classic Logic Vs Fuzzy Logic

Classic Logic
Fuzzy Logic

-fixed logic like boolean                                                -extremities(range of values)

-based on crisp set(0,1)                                               – based on fuzzy set(all values beween 0 and 1)

Applications of Fuzzy Logic

Its implemented in consumer electronics such as cameras, camcorders, washing machines, and microwave ovens and in  industrial process control, medical instrumentation, decision-support systems, natural language processing and in many other fields.

Architecture of Fuzzy Logic


It involves fuzzification process where crisp numbers obtained from sensors are converted into fuzzy sets.

If we obtain speed of car from sensors to be a number like 3kmph, it is mapped to fuzzy function and words are collected like;

Car is moving to too slow.

Rules / Rule Base and Inference Engine

Rule Base contains all the rules and the if then conditions offered by the experts to control the decision making
Inference Engine helps you to determines the degree of match between fuzzy input and the rules Based on the
match, it determines which rules we need to implement according to the given input field. After this, the applied rules
are combined to develop the control actions.



It involves defuzzification process where fuzzy sets are converted to crisp value for quantifiable result. Defuzzification is the interpretation of the membership degree for collected vague values in
first step of fuzzification.

Example: Very slow is indicated by 0.1 .
A bit faster is indicated by 0.9.

Different methods like center of sum, center of gravity are used.

Input: Aggregate output fuzzy set

Output: Single Number

Fuzzy Logic vs Probability

Some people have wrong view about Fuzzy Logic and Probability but these are completely different. Fuzzy logic always represents vagueness or partial truth about something. On the other hand, probability is about events to occur or not occur and it captures partial knowledge about something.

The structure of fuzzy logic system is easy and understandable.
It helps you to control machines and consumer products.
It may not offer accurate reasoning, but the only acceptable reasoning.
It helps you to deal with the uncertainty in engineering.
Mostly robust as no precise inputs required.
It can easily be modified to improve or alter system performance.
Inexpensive sensors can be used which helps you to keep the overall system cost.
It provides a most effective solution to complex issues.

Disadvantages of Fuzzy Logic

We can see that the logic is about partial truth so its not always accurate. Also the verification and validation process requires extensive testing.


Get all slides regarding fuzzy logic and its implementation in washing machine  here.

Get code here .


Be the first to comment

Leave a Reply

Your email address will not be published.