Vous êtes sur la page 1sur 32

INTRODUCTION

The theory of Fuzzy logic is based on the notion of relative graded membership, as inspired
by the processes of human perception and cognition. Lotfi A. Zadeh published his first
famous research paper on fuzzy sets in 1965. Fuzzy logic can deal with information arising
from computational perception and cognition, that is, uncertain, imprecise, vague, partially
true, or without sharp boundaries. Fuzzy logic allows for the inclusion of vague human
assessments in computing problems. Also, it provides an effective means for conflict
resolution of multiple criteria and better assessment of options. New computing methods
based on fuzzy logic can be used in the development of intelligent systems for decision
making, identification, pattern recognition, optimization, and control.

Fuzzy logic is extremely useful for many people involved in research and development
including engineers (electrical, mechanical, civil, chemical, aerospace, agricultural,
biomedical, computer, environmental, geological, industrial, and mechatronics),
mathematicians, computer software developers and researchers, natural scientists (biology,
chemistry, earth science, and physics), medical researchers, social scientists (economics,
management, political science, and psychology), public policy analysts, business analysts,
and jurists.
OBJECTIVES
Afterward concluding this unit, students should be talented to :
1 To define fuzzy variables, form the rule base and use fuzzy reasoning to check the
operability of the rule base.
2 To build fuzzy logic system by using Mat labs fuzzy logic toolbox.

What is Fuzzy logic?


Fuzzy logic is an approach to computing based on "degrees of truth" rather than the usual "true or
false" (1 or 0) Boolean logic on which the modern computer is based.

Fuzzy logic studies reasoning systems in which the notions of truth and falsehood are
considered in a graded fashion, in contrast with classical mathematics where only absolutely
true statements are considered. From the Stanford Encyclopedia of Philosophy: The study of
fuzzy logic can be considered in two different points of view: in a narrow and in a broad.

History of Fuzzy Logic


When we look at the history of Fuzzy Logic, we find that the first important person for its
development was Buddha. He lived in India about 500 BC and founded a religion called
Buddhism. His philosophy was based on the thought that the world is filled with
contradictions, that almost everything contains some of its opposite, or in other words, that
things can be A and not-A at the same time. Here we can see a clear connection between
Buddha's philosophy and modern fuzzy logic.
About 200 years later, the Greek scholar Aristotle developed binary logic. In contrary to
Buddha, Aristotle thought that the world was made up of opposites, for example male versus
female, hot versus cold, dry verus wet, active versus passive. Everything has to be A or notA, it can't be both.
Over the centuries, these two philosophies developed and spread independently. Buddhism
expanded as the religion of India and surrounding states. Aristotle's logic, however, was
accepted by the Greek scholars and later got spread all over Europe; first by the Romans and
then through Christianity. The Christian church created a devil to opposite God, talked about
heaven and hell, and put a holly Maria against a sinful Eve.
Aristotle's binary logic became the base of science; if something got proven with logic, it was
and still is accepted as scientifically correct. Like many others, Russell tried to reduce math
to logic. When he discovered his paradox while working, he got scared himself. It did,
however, give him the honor of being one of the fathers of fuzzy logic.
In 1964, professor Zadeh started wondering, if there wasn't a better logic to use in
machinery.He had the idea that if you could tell an air-conditioner to work a little faster when
it gets hotter, or similar problems, it would be much more efficient than having to give a rule
for each temperature.
Anyway, that was the day fuzzy logic the way we know it today was born; with fuzzy logic
you can tell an air-condidioner to slow down as soon as it gets chilly.
It took a long time until fuzzy logic got accepted even though it fascinated some people right
from the beginning. Besides engineers, philosophers, psychologists, and sociologists soon
became interested in applying fuzzy logic into their sciences.

In the year 1987, the first subway system was built which worked with a fuzzy logic-based
automatic train operation control system in Japan. It was a big success and resulted in a fuzzy
boom. Universities as well as industries got interested in developing the new ideas. First, this
was mainly the case in Japan. Since the relegions in Japan acceped that things can contain
parts of their opposites, it wasn't such a frightening idea as in most other parts of the world.
And fuzzy logic promised lots of money to the industries, which was of course welcome too.

MATLAB fuzzy logic toolbox


MATLAB fuzzy logic toolbox facilitates the development of fuzzy-logic systems
using:

graphical user interface (GUI) tools

command line functionality

The tool can be used for building

Fuzzy Expert Systems

Adaptive Neuro-Fuzzy Inference Systems (ANFIS)

INPUT / OUTPUT
Input status words be:
Too slow
Just right
Too fast
output action words be:
Less voltage (Slow down)
No change
More voltage (Speed up) 14 FIS Editor: Ad

Task 1: Tipping problem

The quality of service in restaurant is evaluated according to scale 1-10, where 10 means
excellent and 0 is poor service. The question is, how much tip we should give, that the
relation between tip and service is correct. Create FIS with GUI following rules below;
There are three main rules:
i.
ii.
iii.

If the service is poor, the tip is cheap


If the service is good, the tip is average
If the service is excellent, the tip is generous

According to US practice, the cheap tip is 5%, average 15% and generous 25% of the total
bill. Formulate fuzzy deduction system tip. Use Matlab Fuzzy Logic Toolbox.

There are several steps that must follow in order to do this experiment
Step 1: open Matlabs command window and type fuzzy

Step 2: The FIS editor

The FIS editor will show the fuzzy system. In this experiment, it consists of single
input and single output. The transfer function or the method will be use is
MAMDANI.
HERE you can name the FIS by click on FILE the EXPORT to workspace Or file the
name for example task_1

Step 3 editing the membership function of input SERVICE

The FIS editor will show the fuzzy system.


Re-name the input and output to variable to Service and Tip respectively.

By editing the name of service membership MF1, MF2 and MF3 to the quality of the service
which are POOR, GOOD and EXCELLENT respectively

The parameter of POOR membership function is [-4 0 4]

The parameter of GOOD membership function is [1 5 9]

The parameter of EXCELLENT membership function is [6 10 14]

Discussion
we have to change the display range value from [0 1] to [0 10], Based on the labsheet was
stated that the service is evaluated according to scale 0-10, where 10 means excellent and 0 is
poor service. There are 3 inputs for service which is poor, good and excellent. The name of
each input is change from mf1 to POOR, mf2 to GOOD and mf3 to EXCELLENT. We
choose Trimf as type of function which is the triangular membership function and has a
triangular shape of graph. Parameters mean the coordinate of each point of triangular. Table
below shows the detail for each service input.

MEMBERSHIP
FUNCTION 1

MEMBERSHIP
FUNCTION 2

MEMBERSHIP
FUNCTION 3

Name:

POOR

GOOD

EXCELLENT

Type:

Trimf

Trimf

Trimf

[1 5 9]

[6 10 14]

Parameters: [-4 0 4]

Step 4 editing the membership function of output TIP

RE name the output variable to Tip

10

Step 5: Editing the membership of Tip

By editing the name of Tip membership MF1, MF2 and MF3 to the quality of the Tip which
are CHEAP, AVERAGE and GENEROUS respectively
The parameter of POOR membership function is [-12 0 12]

11

The parameter of AVERAGE membership function is [3 15 27]

The parameter of GENEROUS membership function is [18 30 42]

12

Discussion:
we have to change the display range value from [0 1] to [0 30]. In the labsheet was stated that
the tips for cheap is 5%, average 15% and generous is 25%. There are 3 MEMBERSHIP
FUNCTION for tips which are cheap, average and generous. The name of each input is
change from mf1 to CHEAP, mf2 to AVERAGE and mf3 to GENEROUS. We choose Trimf
type which is the triangular membership function of graph. The Trimf is chosen because of
the peak point that we want and it easier to read the graph. Parameter means the coordinate of
each point of triangular graph. Table below shows the detail for each tips input.

Tip

MEMBERSHIP
MEMBERSHIP
FUNCTION 1
FUNCTION 2
CHEAP
AVERAGE
Name:
trimf
trimf
Type:
[3 15 27]
Parameters: [-12 0 12]

MEMBERSHIP
FUNCTION 3
GENEROUS
trimf
[18 30 42]

Step 6: Set the fuzzy logic rules for the system

To open the rule window and change it base on the membership function number and the
operation either maximum (OR) or minimum (AND).

13

Step 7: Set the rules for this tipping problem.

In the Rule Editor, we add rule as given in labsheet which is;


1. If service is poor, the tip is cheap
2. If the service is good, the tip is average
3. If the service is excellent, the tip is generous
Step 8: Rule Viewer

14

For the Rule Viewer, it will display the relations of service and tips. As we know, the
quality of service in restaurant is evaluated according scale 1-10 which 0
is poor and 10 is excellent. From the Rule Viewer, we can see that if the
service is at 1.55 (poor), the tips get is 5(cheap). When the service is 4.5
(good), the tips get is 15 (average) and when the service is 7.41
(excellent), the tips given are 25 (generous).

15

Since we have only single input SERVICE and single outputTip


The surface Viewer will only show the graph in 2D and it shows the relationship between the
the Quality of service and the corresponded kind of Tip
From this graph when the service is poor[0-2] the tip is cheap[1-3] and same process for the
rest of rule.

Task 2: FURNACE TEMPERATURE CONTROL


Create FIS for furnace temperature control using command line following data below;
setting
temp
cold

low

medium

high

low

medium

high

cool

low

medium

high

moderate

low

low

low

warm

low

low

low

hot

low

low

low

16

SOLUTIONS:
Step 1: Open new m-file then Write and Run the coding at command window
%Task_2
a=newfis('furnace');
a=addvar(a,'input','TEMPERATURE',[32 112]);
a=addmf(a,'input',1,'cold','trimf',[32 32 52]);
a=addmf(a,'input',1,'cool','trimf',[32 52 72]);
a=addmf(a,'input',1,'moderate','trimf',[62 72 82]);
a=addmf(a,'input',1,'warm','trimf',[72 92 112]);
a=addmf(a,'input',1,'hot','trimf',[92 112 112]);
a=addvar(a,'input','SETTING',[1 10]);
a=addmf(a,'input',2,'low','trimf',[0 0 5]);
a=addmf(a,'input',2,'medium','trimf',[3 5 7]);
a=addmf(a,'input',2,'high','trimf',[5 10 10]);
a=addvar(a,'output','POWER',[0 20]);
a=addmf(a,'output',1,'low','trimf',[0 0 10]);
a=addmf(a,'output',1,'medium','trimf',[5 10 15]);
a=addmf(a,'output',1,'high','trimf',[10 20 20]);
ruleList=[ ...
11111
21111
31111
41111
51111
12211
22211
32111
42111
52111
13311
23311
33111
43111
5 3 1 1 1];
a=addrule(a,ruleList);
fuzzy(a) %displays the FIS Editor.
mfedit(a) %displays the Membership Function Editor.
ruleedit(a) %displays the Rule Editor.
ruleview(a) %displays the Rule Viewer.
surfview(a) %displays the Surface Viewer.

17

Step 2: Fuzzy Inference System

18

Step 3: Membership Function Editor (TEMPERATURE)

19

Step 4: Membership Function Editor (SETTING)

Step 5: Membership Function Editor (POWER)

20

Step 6: Rule Editor

21

Step 7: Rule viewer

The rule viewer will display all the 15 fuzzy rules for furnace control (task 2).
Rule 1

temperature cold
(32C)
setting
low
power
Low
(3.39)

22

Rule 2

temperature cool (51.7C)


setting
low
power
low(3.39)

Rule 3

temperature moderate
(72.3C)
setting
low
power
low(3.39)

23

Rule 4

temperature warm (92.3C)


setting
low
power
low(3.39)

Rule 5

temperature
setting
power

24

hot (112C)
low
low(3.39)

Rule 6

temperature
setting
power

cold (32C)
medium
Medium(10)

Rule 7

temperature
setting
power

25

cool (51.7C)
medium
medium(10)

Rule 8

temperature
setting
power

moderate (71.7C)
medium
low(3.45)

temperature
setting
power

warm (92.3C)
medium
low(3.27)

Rule 9

26

Rule 10

temperature
setting
power

hot (112C)
medium
low(3.27)

temperature
setting
power

cold (32C)
medium
high(16.7)

Rule 11

27

Rule 12

temperature
setting
power

cool (51.7C)
medium
high(16.7)

Rule 13

temperature
setting
power

28

moderate (72.3C)
medium
low(3.27)

Rule 14
temperature
setting
power

warm (92.3C)
medium
low(3.27)

Rule 15

temperature
setting
power

29

hot (112C)
medium
low(3.27)

Step 8: Surface Viewer

Discussion:
This graph shows the relationship between the input which are Temperature and setting and
the correspond output which is power. When the temperature is so low in other word
Cold(40) AND Setting is Low(2) so the power will be Low(5).
What is applied in Role (1), it will be the same procedure till Role 16
This graph shows clearly how the output Power changing based on any changing occur on the
input Temperature and Setting.

30

Discussion:
in this task, we used AND =1
However OR= 2
OUTPUT

INPUT
temperature
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5

setting
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3

power
1
1
1
1
1
2
2
1
1
1
3
3
1
1
1

weight
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

31

AND
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

CONCLUSION
The lab deals with fuzzy logic fundamentals. Introduced the term fuzzy logic and described
the mathematics of fuzzy set theory. Fuzzy set allows partial memberships. Fuzzy sets
represent linguistic labels or term sets such as If the service is poor, the tip is cheap
If the service is good, the tip is average , If the service is excellent, the tip is generous
. Fuzzy membership functions represent term sets.
The membership function is a graphical representation of the magnitude of participation of
each input. It associates a weighting with each of the inputs that are processed, define
functional overlap between inputs, and ultimately determines an output response. The rules
use the input membership values as weighting factors to determine their influence on the
fuzzy output sets of the final output conclusion. Once the functions are inferred, scaled, and
combined, they are defuzzified into a crisp output which drives the system. There are
different memberships functions associated with each input and output response. Some
features to note are:
Fuzzy Logic provides a completely different, unorthodox way to approach a control problem.
This method focuses on what the system should do rather than trying to understand how it
works. One can concentrate on solving the problem rather than trying to model the system
mathematically, if that is even possible. This almost invariably leads to quicker, cheaper
solutions. Once understood, this technology is not difficult to apply and the results are usually
quite surprising and pleasing.

32

Vous aimerez peut-être aussi