How can I generate code from the system I've designed in the fuzzy logic designer?

12 次查看(过去 30 天)

采纳的回答

MathWorks Support Team
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:
  1. 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. 
  2. 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.
  3. 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.
Note that you will need a Simulink Coder license to generate code for your fuzzy logic system.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Fuzzy Logic in Simulink 的更多信息

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by