How to use LQR and code generation?

37 ビュー (過去 30 日間)
Joschua
Joschua 2013 年 12 月 4 日
コメント済み: Victory Friday 2022 年 1 月 21 日
I'm trying to generate C Code of a Simulink model, that contains an embedded Matlab function containing the Matlab LQR(A,B,Q,R,N) function.
But I recieve this error: "The function 'lqr' is not supported for standalone code generation."
I can not use code.extrinsic, because the target won't have MATLAB installed.
Is there a work-around?
  1 件のコメント
Ryan Livingston
Ryan Livingston 2019 年 2 月 13 日
We've made an internal note of your request to support code generation for lqr so it can be considered for the future.

サインインしてコメントする。

回答 (2 件)

John Petersen
John Petersen 2015 年 5 月 29 日
The 'work around' is to write your own Ricatti Eq Solver.
  1 件のコメント
Victory Friday
Victory Friday 2022 年 1 月 21 日

Please can you help me with one

サインインしてコメントする。


Raj
Raj 2019 年 2 月 13 日
Unfortunately there is not work around here. Coder.Extrinsic functions are not supported for code generation. Only call to there functions will come in your generated code. You will have to go to mathematics and write algorithm to solve the Algebraic Riccati Equation.
However, if your system is not time variant (i.e. LTI) systems, I would recommend computing the gain matrix separately and use the gain matrix directly in your model.

カテゴリ

Help Center および File ExchangeSimulink PLC Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by