×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• 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.

# Fuzzy Logic Defuzzyfication

## Fuzzy Logic Defuzzyfication

(OP)
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

#### 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.

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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!