MATLAB: How to log the fired strength of rules in a fuzzy Inference System (FIS) at each simulation step in Fuzzy Logic Toolbox 2.2.8 (R2008b)

Fuzzy Logic Toolbox

I would like to know if there is a provision for logging the firing stength of each rule in an FIS at each step in a simulation.
This feature will enable me to tune the Fuzzy Controller more easily.

Best Answer

There is no direct way to log the firing strength of the rules in an FIS at each step in a simulation in fuzzy Logic Toolbox 2.2.8 (R2008b).
As a workaround, create a scope and log the data from the appropriate block (since the 'Fuzzy Controller with Rule Viewer' block is built from Simulink blocks). Here is a simple illustration of how this can be done:
1. Execute 'sltankrule' - This opens up a DEMO model called SLTANK rule that has a 'Fuzzy Controller with RuleViewer' block.
2. Navigate to the FIS Wizard subsystem (Right click on 'Fuzzy Controller with ruleViewer' and select 'Look under mask', then right-click on 'Fuzzy Logic Controller' and select 'Look under mask', then right-click on 'FIS Wizard' and select 'Look under mask')
3. Then, right click on the second output of each 'Rule' block and select 'Create and Connect Viewer' --> 'Simulink' --> 'Scope'.
4. Open the scope property dialog (second icon from the left on the Viewer: Scope toolbar) and select the 'History' tab. There, make sure to check the 'Save to model signal logging object (logsout)'.
5. Run the model for say 20 seconds and pause/stop model
6. The required signals are logged in the workspace under the 'logsout' object. You can access the data as follows:
logsout.ScopeData.axes1.SL_Rule12.Data
Related Question