MATLAB: Am I receiving an error about invalid port dimensions when using a Fuzzy Logic Controller in Simulink

dimensionsfuzzyFuzzy Logic Toolboxinvalidlogicsimulink

I have created a FIS structure using the Fuzzy Logic Toolbox. This structure is to be used in Simulink with the Fuzzy Logic Controller block. When I run the Simulink model I get an error.
Error in port widths or dimensions. Invalid dimension has been specified for input port 1 of
block 'myfis/Fuzzy Logic Controller with Ruleviewer/Fuzzy Logic Controller/FIS Wizard/power'.

Best Answer

This error will occur if the dimension of the input signal to the Fuzzy Logic Controller block does not match the number of inputs the FIS object is expecting. To check how many inputs a FIS object is expecting, try the following:
fis = readfis('tipper.fis')
You should get the following output:
fis =
name: 'tipper'
type: 'mamdani'
andMethod: 'min'
orMethod: 'max'
defuzzMethod: 'centroid'
impMethod: 'min'
aggMethod: 'max'
input: [1x2 struct]
output: [1x1 struct]
rule: [1x3 struct]
The input is a 1-by-2 structure array indicating that this FIS object is expecting 2 inputs. In Simulink, the dimension of the input to the Fuzzy Logic Controller block needs to have a value of 2.
Related Question