Minimization functions of the optimization toolbox

1 visualizzazione (ultimi 30 giorni)
Safwan
Safwan il 14 Giu 2011
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

Risposte (1)

Mike Hosea
Mike Hosea il 16 Giu 2011
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

Community Treasure Hunt

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

Start Hunting!

Translated by