fortran - Fortran representation of symbolic expression

Syntax

fortran(S)

Description

fortran(S) returns the Fortran code equivalent to the expression S.

Examples

The statements

syms x
f = taylor(log(1+x));
fortran(f) 

return

t0 = x-x**2/2+x**3/3-x**4/4+x**5/5

The statements

H = sym(hilb(3));
fortran(H)

return

H(1,1) = 1            H(1,2) = 1.E0/2.E0    H(1,3) = 1.E0/3.E0
H(2,1) = 1.E0/2.E0    H(2,2) = 1.E0/3.E0    H(2,3) = 1.E0/4.E0
H(3,1) = 1.E0/3.E0    H(3,2) = 1.E0/4.E0    H(3,3) = 1.E0/5.E0

See Also

ccode, latex, pretty

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS