IF..THEN rules
4 次查看(过去 30 天)
显示 更早的评论
Hi,
I want to create if..then rules using Matlab coding. I know that there is tool box for fuzzy, but I am trying to do it in a different way.
Suppose I have 3 membership functions (x1 and x2 are the inputs, and y is the output).
x = 0:0.01:1
x1 = gaussmf(x, [0.125 0.5]) %medium
x2 = gaussmf(x, [0.0625 0.125]) %low
y = gaussmf(x, [0.15 0.6]) %medium
Now I try to relate these membership functions based on this rule:
'If x1 is medium and x2 is low, then y is medium.'
Is there any code for this?
Thank you.
6 个评论
Adam Danz
2019-8-26
If the red curve is the definition of "low" and the blue curves are definitions of "medium" then I would calculate where those curve intersect. If there are 2 "medium" curves, you could take the average of the 2 x values at the two intersections.
采纳的回答
Prabhan Purwar
2019-9-3
Hey,
Following is an example going through various process included for achieving a fully functional fuzzy inference system
Take the example of an autonomous plane flying at an optimal altitude (Ao), and we are trying to control throttle based on altitude.
Ar is the current altitude and error= Ar — Ao. Error-dot is equal to the rate of change of error.
Based on error Let us define the outputs as Increase throttle, No Change, and Decrease Throttle.
Step 1: Initialization
Crisp Input
If the change in error is decreasing = Negative
If the change in error is not change = Zero
If the change in error is increasing = Positive
Crisp output
Increase throttle
(No change)
Decrease throttle.
Step 2: Fuzzification
Assigning a member function for crisp values. Membership function can be Sigmoid function (sigmf), Triangular function (trimf) and many more. Three main membership functions are Increase throttle, (No change) and Decrease throttle.
Step 3:
IF-THEN rules:
If error is Negative (Ar < Ao) and error-dot is Negative THEN Increase throttle.
If error is Zero (Ar = Ao) and error-dot is Zero THEN No Change.
If error is Negative (Ar < Ao) and error-dot is Zero THEN Increase throttle.
In matrix format
The graphs for the membership function sets (error, error-dot and output) looks like:
For the output
For altitude error:
Green color is assigned where answer > 0.
Step 4:
Inference Mechanism
Fuzzy inferences mechanisms are
1. Mamdani fuzzy inference
2. Sugeno fuzzy inference
3. Tsukamoto fuzzy inference
Step 5:
Defuzzification
Using Root-sum-squared calculate the strength of each output membership function, Decrease Throttle, No Change and Increase Throttle.
For more details look over following link:
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fuzzy Inference System Modeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!