- Create your fuzzy system using the fuzzy system designer. Once complete, <https://www.mathworks.com/help/fuzzy/building-systems-with-fuzzy-logic-toolbox-software.html#FP686 export the system> to the MATLAB workspace by selecting File > Export > To Workspace.
- Bring your exported fuzzy system variable into Simulink using a "<https://www.mathworks.com/help/fuzzy/fuzzylogiccontroller.html Fuzzy Logic Controller>" block. <https://www.mathworks.com/help/fuzzy/generate-code-for-fuzzy-system-using-simulink-coder.html This PID control example> demonstrates this. If you open the model from this example, you will notice a structure named "FIS" in the MATLAB workspace. This is a structure that had previously been exported from the fuzzy logic designer. "FIS" was then brought into Simulink using a fuzzy logic controller block named "Fuzzy Inference System" within the subsystem "Fuzzy PID". In the fuzzy logic controller block, specify the name of your fuzzy logic structure (here, it's "FIS"). From here, you can simulate the model and see how the fuzzy logic controller works, given specific inputs.
- When you have completed your model and are ready to generate code for the model, click on the "Build Model" button (or Ctrl-B). When the build process has completed successfully, you will see a new folder in your current folder named "fuzzyPID_grt_rtw". This folder includes all the generated source and header code files your model. Refer to the previously-linked example documentation to read more about the specific files generated.
How can I generate code from the system I've designed in the fuzzy logic designer?
17 views (last 30 days)
Show older comments
Accepted Answer
MathWorks Support Team
on 23 Feb 2018
To generate code for your fuzzy logic system, you will need to bring the logic into a Simulink system. This process generally follows these steps:
Note that you will need a Simulink Coder license to generate code for your fuzzy logic system.
0 Comments
More 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!