Minimization functions of the optimization toolbox

2 ビュー (過去 30 日間)
Safwan
Safwan 2011 年 6 月 14 日
Hi all,
can anybody tell me why the minimization functions of the optimization toolbox can not be converted into C-code by the embedded coder. What about if I implement the algorithms using Simulink For-loops and blocks, will it work?
I want to perform a non-linear fitting (double exponenital fitting) and this is possible in Simulink with the optimization toolbox. However, its functions can not be converted into C. And I want to know why.
Thank you in advance,
Safwan

回答 (1 件)

Mike Hosea
Mike Hosea 2011 年 6 月 16 日
Do you mean for MATLAB? As far as I know, there's no technical reason why the functions cannot be adapted for code generation. There's a table of supported functions in the MATLAB Coder documentation. If something is not on it, in most cases the only "reason" is that it hasn't been done yet. It took decades to get MATLAB where it is today, and each function adapted for code generation requires careful attention and testing, in part because the MATLAB Coder compiler does not support all MATLAB language features, in part because MATLAB Coder requires static typing (because it uses "native" C types instead of mxArrays), and in part because one might want to make different trade-offs when generating code for, say an embedded system than when running in the MATLAB environment on a desktop computer.
You can write your own in MATLAB language if you stick to using only the supported MATLAB functions. You can also use coder.ceval to call a routine that is already implemented in C. -- Mike

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by