Symbolic Math Toolbox | Search  Help Desk | |
ccode | Examples | See Also |
C code representation of a symbolic expression.
ccode(s)
ccode(s)
returns a fragment of C that evaluates the symbolic expression s
.
The statements
syms x f = taylor(log(1+x)); ccode(f)return
t0 = x-x*x/2+x*x*x/3-pow(x,4.0)/4+pow(x,5.0)/5;The statements
H = sym(hilb(3)); ccode(H)return
H[0][0] = 1.0; H[0][1] = 1.0/2.0; H[0][2] = 1.0/3.0; H[1][0] = 1.0/2.0; H[1][1] = 1.0/3.0; H[1][2] = 1.0/4.0; H[2][0] = 1.0/3.0; H[2][1] = 1.0/4.0; H[2][2] = 1.0/5.0;
fortran
, latex
, pretty