Minimization functions of the optimization toolbox
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!