Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Fuzzy Logic Defuzzyfication

Fuzzy Logic Defuzzyfication

Fuzzy Logic Defuzzyfication


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 !


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close