Fuzzy Logic Toolbox: Learning Rules with 'OR' connection

6 views (last 30 days)
Hi Community,
I have been experimenting on fuzzy logic system auto tuning. I found the 'learning' option provided by the toolbox seems only generating rules with 'AND' connection. The 'tuning' option also does not allow me to optimise the connection type between 'AND' and 'OR'.
Is this "learning with 'OR'" functionality not implemented on purpose? Is there a workaround to enable this?
I have read the following documentation webpages:
Best,
Daniel

Answers (1)

Umar
Umar on 27 Jun 2024
Hi Daniel,
for implementing 'OR' connections in the fuzzy logic system auto-tuning process, a potential workaround involves customizing the rule generation or tuning process. This customization can be achieved by manually defining rules with 'OR' connections based on the specific requirements of the system.
Let's consider a hypothetical scenario where we want to incorporate 'OR' connections in the fuzzy logic system. We can create custom rules using the Mamdani fuzzy inference system in MATLAB. Below is a simplified example demonstrating how to define rules with 'OR' connections:
% Define input variables
input = [0 10 20 30 40]; output = [0 1 2 3 4];
% Create fuzzy input/output membership functions
fis = mamfis('Name','customFIS');
fis = addInput(fis,[0 40],'Name','input1',input);
fis = addOutput(fis,[0 4],'Name','output1',output);
% Define custom rules with 'OR' connections
rule1 = "If input1 is 10 or input1 is 20 then output1 is 1";
rule2 = "If input1 is 30 or input1 is 40 then output1 is 4";
% Add rules to the fuzzy inference system
fis = addRule(fis,rule1);
fis = addRule(fis,rule2);
% Evaluate the fuzzy inference system
evalfis([20],fis)
By manually specifying rules with 'OR' connections as shown in the example above, you can introduce the desired logic into the fuzzy system. This approach allows for greater flexibility and customization in rule generation, enabling you to tailor the system to your specific needs.
Hope that answers your question.
  2 Comments
Bingchen
Bingchen on 27 Jun 2024
Thank you Umar for your quick response!
Sure, manually defining the rules works perfectly with the toolbox. Now I am looking for an automated way for 'OR' rule learning from a bunch of data, for example, the 'predict fuel consumption in miles per gallon' from the MATLAB tutorial. Manually observing the data and defining rules is difficult and irrealistic in this scenario.
Umar
Umar on 27 Jun 2024
Hi Daniel,
Glad to help out. Let me know if you need further assistance or help. Good luck with your future endeavors.

Sign in to comment.

Categories

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

Tags

Community Treasure Hunt

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

Start Hunting!