Converting from Matlab output to C++

4 ビュー (過去 30 日間)
Christopher Lee
Christopher Lee 2017 年 11 月 2 日
コメント済み: Eirik Kvalheim 2018 年 7 月 10 日
I'm using the Symbolic Math Toolbox to generate some expressions for use in some C++ code.
Is it possible for Matlab to output pow(x,2) instead of x^2 and if so how?
Is it also possible for Matlab to return and derivatives multiplied by a constant e.g. d/dx(x^2) returns 2*a*x rather than 2*x and if so how? The expressions are typically much more complicated than x^2 and I'm not sure where all of the derivatives would be in the output.
Any help would be greatly appreciated.
  1 件のコメント
Eirik Kvalheim
Eirik Kvalheim 2018 年 7 月 10 日
https://www.mathworks.com/videos/generating-c-code-from-matlab-code-68964.html

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

回答 (1 件)

Nicolas Schmit
Nicolas Schmit 2017 年 11 月 8 日
Convert the symbolic function to a .m file using matlabFunction(). Then, use MATLAB coder to generate C++ code from the .m file.

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by