フィルターのクリア

LQR and c2d not available with matlab coder.

13 ビュー (過去 30 日間)
Dean Montgermy
Dean Montgermy 2020 年 3 月 4 日
回答済み: Vibhav 2024 年 7 月 12 日 16:51
Hi,
i have a matlab code with LQR and c2d function in it but matlab coder doesn't support those functions.
What is the best way to fix this? I search on the internet for the full written matlab algorithms of LQR and c2d but i couldn't find it..
thanks in advance!

回答 (2 件)

Darshan Ramakant Bhat
Darshan Ramakant Bhat 2020 年 3 月 4 日
Unfortunately these two functions are not supported C/C++ code generation yet. I have made an internal request to support these functions in one of the future release.
The way to fix is to re-write the algorithm in MATLAB using the constructs / functions supported for code generation. You can refer to the below example document :
Hope this will help you.
  1 件のコメント
soepblik
soepblik 2020 年 3 月 4 日
Hmm no this doesn’t answer my question. Is there a full written out function of lqr and c2d which i can use then instead?

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


Vibhav
Vibhav 2024 年 7 月 12 日 16:51
I had the same issue where I wanted to generate code for a function that was using c2d, but was failing since c2d doesn't support code generation (very weird that it doesn't given that it is a simple function). I was able to circumvent the issue by simply looking at the source code for the c2d function and replacing it directly in my code. You can view the available source code for any MATLAB function by running
>> edit <function_name>
in the command window (in this case >> edit c2d). Alternatively, although I haven't tried this myself, you could try adding the codegen pragma %#codegen to your local copy of c2d and see if that works for code generation. Note that these are basically hacks and may be unreliable. For reliability, it is best to wait for MathWorks to add codegen functionality to these functions.
Unfortunately, this seems to not be possible for the lqr function since it has dependencies on other functions in the control systems toolbox (although you could still try the codegen pragma hack and see if that works).

カテゴリ

Help Center および File ExchangeDeep Learning with GPU Coder についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by