Clear Filters
Clear Filters

How to create complex 'or', 'and' and 'not' operations in fuzzy inference rules

10 views (last 30 days)
I have a mamdani type 1 system, I want to create two rules
if (a or b) and c then d
if not ((a or b) and c) then e
However, in the fuzzy logic designer the options are use only 'and's or 'or's as connection without the ability to combine them

Accepted Answer

Shubham
Shubham on 9 Sep 2024
Edited: Shubham on 9 Sep 2024
Hi Raul,
In Fuzzy Logic Designer, you can implement the desired logic by creating additional variables or breaking the rules into simpler components. Here's how you can achieve this:
Step-by-Step Instructions:
  1. Create a Fuzzy Inference System (FIS):
  • Open MATLAB and type fuzzy in the command window to launch the Fuzzy Logic Designer.
  • Create a new FIS (Mamdani type).
2. Define Input Variables:
  • Add input variables a, b, and c.
  • Define the membership functions for each input variable according to your system requirements.
3. Define Output Variables:
  • Add output variables d and e.
  • Define the membership functions for each output variable.
4. Create Intermediate Variable:
  • Since you cannot directly combine and and or, create an intermediate output variable x to represent (a or b).
  • Define membership functions for x as necessary.
5. Define Rules:
  • Intermediate Rules for x:
  • Rule 1: If a is high, then x is high.
  • Rule 2: If b is high, then x is high.
  • Main Rules:
  • Rule 3: If x is high and c is high, then d is high.
  • Rule 4: If x is not high or c is not high, then e is high.
6. Configure the Rules:
  • In the Fuzzy Logic Designer, go to the "Rules" tab.
  • Add the rules as described above, using the rule editor to specify the logic.
7. Simulate and Test:
  • Use the "View" options to simulate and test your fuzzy logic system.
  • Adjust membership functions and rules as needed to achieve the desired behavior.

More Answers (1)

Divyajyoti Nayak
Divyajyoti Nayak on 9 Sep 2024
Hi Raul,
I understand that you want to create complex rules for your Fuzzy Logic System but MATLAB does not support the use of both ‘AND’ and ‘OR’ connections together for the creation of rules in Fuzzy Systems. To make rules that fulfil the given conditions, please make separate rules using only ‘AND’ or ‘OR’ conditions.
I am assuming ‘a’, ‘b’ and ‘c’ are three inputs that can be true or false, and ‘d’ and ‘e’ are the two member functions of the output. The rules for the conditions would look something like this:
%(a OR b) AND c then d
rule1 = "a == true & c == true => output = d";
rule2 = "b == true & c == true => output = d";
%not((a OR b) AND c) then e
rule3 = "a == false & b == false => output = e";
rule4 = "c == false => output = e"
Here's the documentation for adding rules in the 'Fuzzy Logic Designer' app:
Hope this helps!

Categories

Find more on Fuzzy Logic in Simulink in Help Center and File Exchange

Tags

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!