# What is Fuzzy Logic ? | Fuzzy Logic Tutorial

## Fuzzy Logic

- The
**'Fuzzy'**word means ability the matters that are not clear or are vague. - Sometimes, we can't decide in real life that the given statement or problem is either true or false.
- At that time, this concept provides many values between the true and false and gives the flexibility to find the answer to that problem.

## Example of Fuzzy Logic as comparing to Boolean Logic

- Fuzzy logic carries the more than one logical values and these values are the truth values of a variable or problem between 0 and 1. This idea was once introduced by way of
**Lofti Zadeh**in**1965**based on the Fuzzy Set Theory. - This notion provides the chances which are not given by computers, but similar to the range of chances generated by humans.
- In the Boolean system, only two probabilities
**(0 and 1)**exist, the place 1 denotes the**absolute truth value**and zero denotes the**absolute false value**. But in the fuzzy system, there are more than one probabilities present between the 0 and 1, which are partially false and partially true. - The Fuzzy logic can be applied in systems such as micro-controllers, workstation-based or network-based systems for achieving the specific output. It can also be applied in both hardware or software.

Fuzzy logic as comparing to Boolean logic

## Characteristics of Fuzzy Logic

- It is used for supporting the minimization of the logics created with the aid of the human.
- It is the easiest technique for locating the answer of these problems which are suitable for approximate or unsure reasoning.
- In Fuzzy logic , everything may additionally be a matter of degree.
- In the Fuzzy logic , any system which is logical can be easily solved.
- It additionally permits users to combine with the programming.
- It always provides two values, which denote the two possible options for a problem and statement.
- This idea is flexible and that we can easily understand and implement it.
- It allows users to build or create the functions which are
**non-linear**of arbitrary complexity. - It is based on natural language processing.
- It is additionally used by the quantitative analysts for improving their algorithm's execution.

Characterstics of Fuzzy Logics

## Architecture of a Fuzzy logic System

In the architecture of the Fuzzy logic system, each component plays an important role. The architecture consists of the various four components which are given below.

- Rule Base
- Fuzzification
- Inference Engine
- Defuzzification

Following diagram shows the architecture or process of a Fuzzy logic system

Fuzzy Logic Architecture

## 1. Rule Base

- Rule Base is a factor used for storing the set of rules and the If-Then conditions given by using the specialists are used for controlling the
**decision-making**systems. - There are so many updates that come in the Fuzzy principle recently, which gives effective techniques for designing and tuning of fuzzy controllers.
- These updates or developments decreases the variety of fuzzy set of rules.

## 2. Fuzzification

- Fuzzification may be a module or component for transforming the system inputs, i.e., it converts the crisp number into fuzzy steps.
- The crisp numbers are those inputs which are measured by the sensors then fuzzification passed them into the control systems for further processing.
- This component divides the input signals into following five states in any Fuzzy logic system:
- Large Positive (LP)
- Medium Positive (MP)
- Small (S)
- Medium Negative (MN)
- Large negative (LN)

## 3. Inference Engine

- This component may be a main component in any Fuzzy logic system (FLS), because all the information is processed within the Inference Engine.
- It allows users to seek out the matching degree between the current fuzzy input and therefore the rules.
- After the matching degree, this technique determines which rule is to be added according to the given input field. When all rules are fired, then they're combined for developing the control actions.

## 4. Defuzzification

- Defuzzification may be a module or component, which takes the fuzzy set inputs generated by the Inference Engine, then transforms them into a crisp value.
- It's the last step within the process of a Fuzzy logic system.
- The crisp value may be a type of value which is acceptable by the user.
- Various techniques are present to try to this, but the user has got to select the simplest one for reducing the errors.

## Membership Function

- The membership function may be a function which represents the graph of fuzzy sets, and allows users to quantify the linguistic term. It's a graph which is employed for mapping each element of x to the value between 0 and 1.
- This function is additionally referred to as indicator or characteristics function. This function of Membership was introduced within the first papers of fuzzy set by
**Zadeh**. - For the Fuzzy set B, the membership function for X is defined as:
**μB:X → [0,1]**. During this function X, each element of set B is mapped to the value between 0 and 1. - This is often called a degree of membership or membership value.

## Classical and Fuzzy Set Theory

- To learn about classical and Fuzzy Set Theory , firstly you've got to understand about what's set.

## Set

- A set may be a term, which may be a collection of unordered or ordered elements. Following are the samples of a set:
- A set of all-natural numbers
- A set of students in a class.
- A set of all cities in a state.
- A set of upper-case letters of the alphabet.

Set

## Types of Set

- Finite
- Empty
- Infinite
- Proper
- Universal
- Subset
- Singleton
- Equivalent Set
- Disjoint Set

Types of Set

## Classical Set

- It is a kind of set which collects the distinct objects in a group. The sets with the crisp boundaries are classical sets. In any set, each single entity is named a element or member of that set.

## Mathematical Representation of Sets

- Any set are often easily denoted within the following two different ways:

## 1. Roaster Form

- This is often also called as a tabular form. In this form, the set is represented within the following way:

- The elements within the set are enclosed within the brackets and separated by the commas.

Following are the 2 examples which describes the set in Roaster or Tabular form:

## Example 1

## Example 2

## 2. Set Builder Form

- Set Builder form defines a group with the common properties of a component in a set. In this form, the set is represented within the following way:
- A = {x:p(x)}

- The following example describes the set within the builder form:

## Operations on Classical Set

- Following are the various operations which are performed on the classical sets:
- Union Operation
- Intersection Operation
- Difference Operation
- Complement Operation

Operations of Classical Set

## Union

- This operation is denoted by (A U B). A U B is that the set of these elements which exist in two different sets A and B. This operation combines all the weather from both the sets and make a new set. It's also called a
**Logical OR operation**. - It are often described as:

`A ∪ B = { x | x ∈ A OR x ∈ B }.`

## Example

## Intersection

- This operation is denoted by (A ∩ B). A ∩ B is that the set of these elements which are common in both set A and B. It's also called a
**Logical OR operation**. - It are often described as:

`A ∩ B = { x | x ∈ A AND x ∈ B }.`

## Example

## Difference Operation

- This operation is denoted by (A - B). A-B is that the set of only those elements which exist only in set A but not in set B.
- It is described as:
- A - B = { x | x ∈ A AND x ∉ B }.

## Complement Operation

- This operation is denoted by (A`). It's applied on one set. A` is that the set of elements which don't exist in set A.
- It is described as:

`A′ = {x|x ∉ A}.`

## Properties of Classical Set

- There are following various properties which play an important role for finding the answer of a Fuzzy logic problem.

Properties of Classic Set

## 1. Commutative Property

- This property provides the following two states which are obtained by two finite sets A and B:
- A ∪ B = B ∪ A
- A ∩ B = B ∩ A

## 2. Associative Property

- This property also provides the following two states but these are obtained by three different finite sets A, B, and C:
- A ∪ (B ∪ C) = (A ∪ B) ∪ C
- A ∩ (B ∩ C) = (A ∩ B) ∩ C

## 3. Idempotency Property

- This property also provides the following two states except for one finite set A:
- A ∪ A = A
- A ∩ A = A

## 4. Absorption Property

- This property also provides the following two states for any two finite sets A and B:
- A ∪ (A ∩ B) = A
- A ∩ (A ∪ B) = A

## 5. Distributive Property

- This property also provides the following two states for any three finite sets A, B, and C:
- A∪ (B ∩ C) = (A ∪ B)∩ (A ∪ C)
- A∩ (B ∪ C) = (A∩B) ∪ (A∩C)

## 6. Identity Property

- This property provides four states for any finite set A and Universal set X:
- A ∪ φ =A
- A ∩ X = A
- A ∩ φ = φ
- A ∪ X = X

## 7. Transitive property

- This property gives the state for the finite sets A, B, and C:
- If A ⊆ B ⊆ C, then A ⊆ C

## 8. Ivolution property

- This property provides following state for any finite set A:

## 9. De Morgan's Law

- This law gives the following rules for providing the contradiction and tautologies:

## Fuzzy Set

- The set principle of classical is the subset of Fuzzy set theory. Fuzzy logic is primarily based on this theory, which is a generalisation of the classical theory of set (i.e., crisp set) introduced by
**Zadeh in 1965.**A fuzzy set may be a collection of values which exist between 0 and 1. - Fuzzy sets are denoted or represented by the tilde (~) character.
- The sets of Fuzzy theory were introduced in
**1965 by Lofti A. Zadeh and Dieter Klaua.** - Within the fuzzy set, the partial membership also exists. This theory released as an extension of classical set theory.
- This theory is denoted mathematically as A fuzzy set (Ã) may be a pair of U and M, where U is that the Universe of discourse and M is that the membership function which takes on values within the interval [ 0, 1 ]. The universe of discourse (U) is additionally denoted by Ω or X.

## Operations on Fuzzy Set

- The operations of Fuzzy set are as follows:
- Union Operation
- Intersection Operation
- Complement Operation

Operations on Fuzzy Set

- Given à and B are the 2 fuzzy sets, and X be the universe of discourse with the following respective member functions:

## Union Operation

- The union operation of a fuzzy set is defined by:

`μA∪B(x) = max (μA(x), μB(x))`

## Example

Let's suppose A may be a set which contains following elements:

And, B may be a set which contains following elements:

Then,

Because, According with this operation

## For X1

## For X2

## For X3

## For X4

## Intersection Operation

- The intersection operation of fuzzy set is defined by

`μA∩B(x) = min (μA(x), μB(x))`

## Example

Let's suppose A may be a set which contains following elements:

And, B may be a set which contains following elements:

Then,

Because, According with this operation

## For X1

## For X2

## For X3

## For X4

## Complement Operation

- The complement operation of fuzzy set is defined by:

`μĀ(x) = 1-μA(x)`

## Example

Let's suppose A may be a set which contains following elements:

Then,

Because, According with this operation

## For X1

## For X2

## For X3

## For X4

## Classical Vs Fuzzy Set

Classical Set Theory | Fuzzy Set Theory |
---|---|

This theory is a class of those sets having sharp boundaries. |
This theory is a class of those sets having un-sharp boundaries. |

This set theory is defined by exact boundaries only 0 and 1. | This set theory is defined by ambiguous boundaries. |

In this theory, there is no uncertainty about the boundary's location of a set. | In this theory, there always exists uncertainty about the boundary's location of a set. |

This theory is widely used in the design of digital systems. | It is mainly used for fuzzy controllers. |

## Applications of Fuzzy logic

- It is used in
**Automative systems**for controlling the**traffic and speed,**and for improving the efficiency of automatic transmissions. Automative systems also use the shift scheduling method for automatic transmissions. - This concept is additionally used in the
**Defence**in various areas. Defence mainly uses the Fuzzy logic systems for underwater target recognition and therefore the automatic target recognition of thermal infrared images. - It is also widely used in the
**Pattern Recognition and Classification**within the sort of Fuzzy logic-based recognition and handwriting recognition. It’s also used in the searching of fuzzy images. - Fuzzy logic systems also used in
**Securities**,**microwave**for setting the lunes power and cooking strategy. - This technique is additionally used in the world of modern control systems like expert systems.
- Finance is additionally another application where this idea is used for predicting the
**stock market**and for managing the funds. - It is also used for
**controlling**the brakes. - It is also used in
**heaters, air conditioners, and humidifiers.** - It is also used in the industries of chemicals for controlling the ph, and
**chemical distillation**process. - It is used in Businesses for decision-making network.
- It is also used in the industries of producing for the optimization of
**milk and cheese**production. - It is also used in the
**vacuum cleaners**, and therefore the timings of washing machines.

## Advantages of Fuzzy logic

- Any user can easily understand the structure of Fuzzy logic.
- It doesn't need an large memory, because the algorithms are often easily described with fewer data.
- Due to its flexibility, any user can easily add and delete rules within the FLS system.
- It is widely used in all fields of life and simply provides effective solutions to the issues which have high complexity.
- The methodology of this idea works similarly because the human reasoning.
- This concept is based on the set theory of mathematics, so that's why it's simple.
- It allows users for controlling the control machines and consumer products.
- The development time of Fuzzy logic is short as compared to standard methods.

## Disadvantages of Fuzzy logic

- Users can know it easily if they're simple.
- The systems of a Fuzzy logic need more testing for
**verification**and**validation.** - The possibilities produced by the Fuzzy logic system aren't always accurate.
- Many researchers give various ways for solving a given statement using this system which results in ambiguity
- The run time of Fuzzy logic systems is slow and takes an extended time to produce outputs.
- Fuzzy logics aren't suitable for those problems that need high accuracy.