13
Fuzzy tool box manual for tip calculation By- Sanchita Singha To use the fuzzy tool box, at first we have to write only "fuzzy" at the command window, and then press Enter. >>fuzzy Then a FIS Editor window will open- Then we use ctrl+s to save it. the output will be .fis or we can say FIS file type.

fuzzy toolbox manual for tip calculation

Embed Size (px)

DESCRIPTION

Fuzzy tool box manual example for tip calculation

Citation preview

Page 1: fuzzy toolbox manual for tip  calculation

Fuzzy tool box manual for tip calculation

By- Sanchita Singha

To use the fuzzy tool box, at first we have to write only "fuzzy" at the command window, and

then press Enter.

>>fuzzy

Then a FIS Editor window will open-

Then we use ctrl+s to save it. the output will be .fis or we can say FIS file type.

Page 2: fuzzy toolbox manual for tip  calculation

Here we save it as "tipcal.fis".

Here we can see the input, then the system(tipcal) then the output.

Now select the existing input and output and delete or remove them except the existing system.

Page 3: fuzzy toolbox manual for tip  calculation

We Remove them by selecting the input or output first the go to Edit, then select- Remove Selected

Variable or by directly pressing Ctrl+X.

Now we will add variables as 2 input variables and 1 output variable.

For adding an input variable we have to do the following steps-

Go to Edit ---> Add variable-->Input

here we have taken 2 input variables FOOD and SERVICES

For adding an output variable we have to do the following steps-

Go to Edit ---> Add variable-->Output

Here we have taken 1 output variable TIP

After adding input and output variables change their names by selecting them

After changing the names the FIS Editor will look like-

Page 4: fuzzy toolbox manual for tip  calculation

Then we will change the range of each variables, by double clicking on the variables. Then a

new window known as Membership Function Editor : tipcal will open. We will assign the input

parameter Food to range to [0 50] and the other input parameter Service to range to [0 50]. and

the output variable Tip to [0 1000] and then the window will look like-

Page 5: fuzzy toolbox manual for tip  calculation

Then we will remove all the existing membership functions.

After Removing existing Membership functions the Membership Function Editor window will look

like-

Page 6: fuzzy toolbox manual for tip  calculation

Now we will add membership functions of our own choice. For adding new membership

functions we first go to Edit then Add MFs-

After selecting Add MFs we will get a new window which is, Membership Function window-

Here We will choose What kind of MFs we want to add and what would be the no of MFs we want

to add. It has a number of choice available for MF type.

Page 7: fuzzy toolbox manual for tip  calculation

As here we have food as 3 types which are Delicious, Average and Worst. So we take Triangular

MF or trimf and Number of MFs as 3.And there are also 3 types of Service which are Excellent,

Average, and Worst so we take Trapezoidal MF and Number of MFs as 3. And also there are 3

types of tips which are High, Medium and Low so we take Trapezoidal MF and Number of MFs as

3.So now the

Membership

Function

Editor: tipcal

will look like-

Now we will chance the parameters-

Page 8: fuzzy toolbox manual for tip  calculation

Let for Food the definition of Delicious is above 30, Average is within 15-35, and Worst is below

20. For Service the definition of Excellent is above 30, Average is within 15-35, and Worst is below

20. And for Tip the definition of High is above 700, Medium is within 300-700 and Low is below

300.

So now we will at first select each line and write the parameter for Food-

So for worst the parameters will be [0 0 50] and the name will be Worst

For Average the parameter will be [0 25 50] and the name will be Average

For Delicious the parameter will be [0 50 50] and the name will be Delicious

Now we will select each line and write the parameter for Service-

So for Worst the parameter will be [0 0 20 50] and the name will be Worst

For Average the parameter will be [0 15 35 50] and the name will be Average

For Excellent the parameter will be [0 30 50 50] and the name will be Excellent

Now we will select each line and write the parameter for Tip-

So for Low the parameter will be [0 0 300 1000] and the name will be Low

For Medium the parameter will be [0 300 700 1000] and the name will be Medium

For High the parameter will be [0 700 1000 1000] and the name will be High

Page 9: fuzzy toolbox manual for tip  calculation

And

Now we will define the rules by double clicking on the system, a Rule Editor Window will

open-

Page 10: fuzzy toolbox manual for tip  calculation

After writing all the rules we get the following window-

Here Rules I had Taken are-

1. If the Food Delicious and Service is Excellent then Tip is High.

2. If the Food Delicious and Service is Average then Tip is High.

3. If the Food Delicious and Service is Worst then Tip is Medium.

4. If the Food Average and Service is Excellent then Tip is Medium.

5. If the Food Average and Service is Average then Tip is Medium.

6. If the Food Average and Service is Worst then Tip is Low.

7. If the Food Worst and Service is Excellent then Tip is Medium.

8. If the Food Worst and Service is Average then Tip is Low.

9. If the Food Worst and Service is Worst then Tip is Low.

Page 11: fuzzy toolbox manual for tip  calculation

-Now to view the output we first click on View the select rules or by directly pressing Ctrl+5

Then the output or the Transfer function will be shown at Rule Viewer Window, for centroid

Defuzzification-

Page 12: fuzzy toolbox manual for tip  calculation

For some other input the variation of the output is shown here in min of max-

Page 13: fuzzy toolbox manual for tip  calculation

The Surface graph for the centroid Defuzzyfication is shown below-