Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fuzzy Logic Defuzzyfication

Status
Not open for further replies.

Alecs2613

Mechanical
Jul 12, 2007
1
0
0
CA
Hi,

I started exploring Fuzzy Logic. Thanks to some tutorials, I was able to implement one on a DC motor.
However, there are some choices that I don't understand and it really bugs me.

I have two inputs: Error (from -10 to 10 which can be Neg, Zero, Pos) and Derivative (from -100 to 100 which can be Neg, Zero, Pos).
The output is a voltage (from -1 to 1 which can be Neg, Zero, Pos).

The rules are shown in the attached image. For Err=4 and Der=70, I have: Err_Zero = 0.6, Err_Pos = 0.4 and Der_Zero = 0.3, Der_Pos = 0.7.
This triggers 4 rules: ZZ and ZP leads to a Zero output with ZZ (0.6 from Err and 0.3 from Der) and ZP (0.6,0.7).
The other rules all lead to a Neg output PZ (0.4,0.3) and PP (0.4,0.7).

From here, I am not sure what to do. Through the tutorials I used, I saw two approches centroids and average weights. I am not sure which one would be best.

1) Centroids (as seems to be done in Matlab Toolbox): For each class, PZ, PP, ZZ, ZP, I took the minimum value. ZZ (0.3); ZP (0.6); PZ (0.3); PP (0.4). Then, for each output class (Neg and Zero), I took the maximum value. Zero: max(ZZ,ZP) = 0.6 and Neg: max(PZ,PP) = 0.4. From there, I trunk the output triangles at 0.6 and 0.4 (see figure) and found the center of mass. I am really not sure about this procedure. I think we first take the min value because my conditions are (if Err AND Deriv then) but I am not sure to understand why we should then take the max value. The result is -0.419. Matlab output is -0.4164.

2) The second approach was to take again the minimum value (because of the AND condition) ZZ (0.3); ZP (0.6); PZ (0.3); PP (0.4) and to compute an average weight. Output Neg is -1 and Zero is 0.
(N*ZZ + N*ZP + Z*PZ + Z*PP) / (ZZ+ZP+PZ+PP)
(-1*0.3 -1*0.6 + 0*0.3 + 0*0.4) / (0.3+0.6+0.3+0.4) = -0.5625. Matlab output is -0.4164.

In summary, the questions are:
1) Which approach to take between 1 and 2
2) For the 1st approach, am I doing it right ? Why take the min and max of the class ?

Thank you very much for your help !

Alex
 
 http://files.engineering.com/getfile.aspx?folder=bf2ad5e1-f06d-49d7-9736-03e92e3827b6&file=Fuzzya.png
Status
Not open for further replies.
Back
Top