State feedback in Simulink for code generation

조회 수: 2 (최근 30일)
Daniel Varga
Daniel Varga 2024년 10월 16일
편집: Ashok 2024년 10월 28일
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일
편집: Ashok 2024년 10월 28일
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