Jan 4, 2011

Fuzzy Logic Explained

Today, I was reading a very short tutorial about Fuzzy Logic. It was particularly interesting because it was lecture notes from 1997, and despite the age, it was fresh and crisp and clear. Crisp, huh, what an interesting word to choose.

So the author explained fuzzy systems by a great example: lawn sprinkler system. I'm going to give you my 2 cent, quick summary of the paper.
1- you need two inputs. Example: a) outdoor air temperature b) soil moisture
2- Knowledge Base
a. Create membership function: For example. Cold is 30-47, Cool=40-70, normal=60-84,warm=75-94, hot=90-110
So one temperature membership function, and one moisture membership function. What's interesting here is that both these axis are calibrated to a y axis, called mu.


b. Make if then rules. The rule base needs to be verified by some sort of validated knowledge.

c. Fuzzification Module:
The name itself tells you alot about what is happeneing. Fuzzification of crisp inputs are made to fuzzy inputs. For example, outside temperature of 90 degrees would be transformed to 0.23 of "warm" in fuzzy terms.


d.Now it's time for decision making(rule strength). We use Min Max to make decisions.
example: if temp is hot (0.6) and soil is dry(0.27), then water duration is long. RS=0.27

e.Determine Fuzzy output: So if you have four outputs from D, then you go with majority. So if you have 2 long, and 2 mediums, your fuzzy output is long! The max of the rule strengths!

f. Lastly, it's time for Defuzzification: The purpose is to take the output of step e( fuzzy output), and come up with a crisp value. There are 4-5 methods to come up with a value, but in the lecture note, they use Center OF GRAVITY.


COG takes the area in abcdef, and finds the center of gravity. I'll hopefully have some time to add more ways to find the center of gravity.

The entire process is best captured in this diagram that I found on the internet.