Error using Fuzzy Logic Controller in Simulink Model
5 views (last 30 days)
Show older comments
I am using Fuzzy Logic Controller in MATLAB R2017a. Here's my code for controller.
[System]
Name='Fuzzy_Controller'
Type='mamdani'
Version=2.0
NumInputs=1
NumOutputs=3
NumRules=5
AndMethod='min'
OrMethod='max'
ImpMethod='min'
AggMethod='max'
DefuzzMethod='centroid'
[Input1]
Name='e'
Range=[-1 1]
NumMFs=5
MF1='NB':'trimf',[-1 -1 -0.7]
MF2='NM':'trimf',[-0.8 -0.5 -0.2]
MF3='Z':'trimf',[-0.3 0 0.3]
MF4='PM':'trimf',[0.2 0.5 0.8]
MF5='PB':'trimf',[0.7 1 1]
[Output1]
Name='Kp'
Range=[-5 5]
NumMFs=5
MF1='NB':'trimf',[-5 -5 -3.45]
MF2='NM':'trimf',[-4.2 -2.5 -0.8]
MF3='Z':'trimf',[-1.6 0 1.6]
MF4='PM':'trimf',[0.75 2.5 4.2]
MF5='PB':'trimf',[3.4 5 5]
[Output2]
Name='Ki'
Range=[-0.25 0.25]
NumMFs=5
MF1='NB':'trimf',[-0.25 -0.25 -0.17]
MF2='NM':'trimf',[-0.215 -0.13 -0.035]
MF3='Z':'trimf',[-0.085 0 0.08]
MF4='PM':'trimf',[0.04 0.125 0.215]
MF5='PB':'trimf',[0.17 0.25 0.25]
[Output3]
Name='Kd'
Range=[-1 1]
NumMFs=5
MF1='NB':'trimf',[-1 -1 -0.69]
MF2='NM':'trimf',[-0.84 -0.5 -0.16]
MF3='Z':'trimf',[-0.33 0 0.33]
MF4='PM':'trimf',[0.16 0.5 0.85]
MF5='PB':'trimf',[0.65 1 1]
[Rules]
1, 1 1 1 (1) : 1
2, 2 2 2 (1) : 1
3, 3 3 3 (1) : 1
4, 4 4 4 (1) : 1
5, 5 5 5 (1) : 1
But When I execute this controller, It gives me this error: How do I correct this.
Error in 'model3_FUZZY/Fuzzy_PID_Controller/Fuzzy_Controller': Initialization commands cannot be evaluated.
Caused by:
Struct contents reference from a non-struct array object.
0 Comments
Answers (0)
See Also
Categories
Find more on Fuzzy Logic in Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!