Control Underactuated Two-Link Robot Using C/GMRES Solver Example Generates Distinct Result
显示 更早的评论
I was learning Nonlinear Model Predictive Controller (NMPC) recently and tried to reproduce the Control Underactuated Two-Link Robot Using C/GMRES Solver Example in the MATLAB Online platform. When I run the all code sections first time, the simulation result is correct. However, when I run the Closed Loop Simulation (CLS) code section repeatedly, the simulation result is different.
Through debugging, I find that the problem was caused by Code Generation section. For obtaining correct result, I have to run the code generation to reproduce the .mex function.
I would like to know why it is necessary to generate mex file every time in order to obtain correct simulation result.
Fig 1. correct result with reprodecing mex file Fig 2. result without reproducing mex file

回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Model Predictive Control Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!