필터 지우기
필터 지우기

IF..THEN rules

조회 수: 6 (최근 30일)
muhammad muda
muhammad muda 2019년 8월 26일
답변: Prabhan Purwar 2019년 9월 3일
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
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.
muhammad muda
muhammad muda 2019년 8월 26일
sorry for the misunderstanding. the terms low and medium are just for examples, hence are not the focus of the question. what i am trying to do is to build a fuzzy inference system; adding variables (input and output), add membership functions for each variables, and finally adding the rules. I know, this is similar to the fuzzy toolbox, but I am just trying different method (coding). any simpilified examples are welcome. by the way thank you all for the help.

댓글을 달려면 로그인하십시오.

채택된 답변

Prabhan Purwar
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개)

카테고리

Help CenterFile Exchange에서 Fuzzy Inference System Modeling에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by