State feedback in Simulink for code generation

19 次查看(过去 30 天)
Is it possible to design state feedback matrices (either with pole placement or the LQR method) in Simulink, such that it supports code generation? The code will run in an embedded environment without access to the Matlab engine at runtime (so declaring functions as external is not an option). The calculations have to take place at regular intervals, so importing the result from a pre-run Matlab script also doesn't work. I have a general MIMO system, for which implementing this for myself seems a huge amount of work, which I'd like to avoid...

回答(1 个)

Ashok
Ashok 2024-10-28,6:51
编辑:Ashok 2024-10-28,6:52
The Control System Designer app is useful for designing single-input, single-output (SISO) controllers for feedback systems modeled in MATLAB or Simulink. Here's an example of designing an LQR controller using the app:
Currently, there's no direct way to generate code for the controller design procedures used by the app. For state-space control design, a list of MATLAB functions can be found here:
However, these functions do not support code generation, as they are not listed on this page, which lists the MATLAB functions that support code generation:
Additionally, the following MATLAB Answers also state that these functions do not support code generation. Staff have mentioned that internal requests have been made to enable this in future releases:
The only workaround mentioned is to write a custom Riccati equation solver. For linear time-invariant (LTI) systems, it's recommended to compute the gain matrix separately and use it directly in the model.
I hope this answers your query!

类别

Help CenterFile Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by