# Matlab Fuzzy Logic Toolbox - OR statement in one input

5 views (last 30 days)
Marko Stalmatovic on 20 Nov 2020
Edited: Marko Stalmatovic on 29 Nov 2020
Dear,
I have one question about rules in Matlab Fuzzy Toolbox. Is it possible to add OR statement in one input between Membership function in one rule?
Example:
[Input1]
Name='Age'
Range=[18 100]
NumMFs=3
MF1='young':'trapmf',[0 1 23 37]
MF2='middle_aged':'trapmf',[23 37 53 67]
MF3='old':'trapmf',[53 67 100 100]
[Output1]
Range=[0 10]
NumMFs=3
MF1='Migraine':'trimf',[0 2 4]
MF2='TTH':'trimf',[2 4 6]
MF3='TACs':'trimf',[5 7 9]
[Rules]
1. If (Age is young or old) then (Primary_Headches_Types is Migraine) (1)
Or something like this:
[Rules]
1. If (Age is young) or (Age is old) then (Primary_Headches_Types is Migraine) (1)
P.S. This is just simple example, my issue is very complexed. I use Mamadani system.
How can I do something like this to scale the number of rules because I will have over 1200 of them.
Thanks so much for the answer in advance and have a nice weekend!
Best Regards,
Marko Štalmatović

Mohith Kulkarni on 25 Nov 2020
The addrule function is supporting only one membership function for each input. Even if you add the rule with OR connectiion between membership function of the same input, the rule is being created with the antecedent property having only one of the specified membership function for the input.
As a workaround, two different rules, one for each membership function can be added in such cases.
I have brought this issue to the notice of our developers. They will investigate the matter further.
Marko Stalmatovic on 29 Nov 2020
Edited: Marko Stalmatovic on 29 Nov 2020
Dear,
I understand and hope that two MF can be added in same input in the near future.
Best Regards,
Marko Štalmatović

### Categories

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

R2020b

### Community Treasure Hunt

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

Start Hunting!