Control Underactuated Two-Link Robot Using C/GMRES Solver Example Generates Distinct Result
Ältere Kommentare anzeigen
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

Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Code Generation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!