Main Content

formula

Return body of symbolic function or matrix function

Description

formula(f) returns the body, or definition, of the symbolic function or matrix function f.

example

Examples

collapse all

Return the body, or definition, of a symbolic function by using formula.

syms x y
f(x,y) = x + y;
formula(f)
ans = x+y

If the symbolic function does not have a definition, formula returns the symbolic function.

syms g(x,y)
formula(g)
ans = g(x,y)

Return the body, or definition, of a symbolic matrix function by using formula.

syms A 2 matrix
syms f(A) 2 matrix keepargs
f(A) = A*A - 3*A + 2*eye(2);
formula(f)
ans = 2I2-3A+A2

If the symbolic matrix function does not have a definition, formula returns the symbolic matrix function.

syms g(A) [1 2] matrix keepargs
formula(g)
ans = g(A)

Input Arguments

collapse all

Input function, specified as a symbolic function or symbolic matrix function.

Data Types: symfun | symfunmatrix

Version History

Introduced in R2012a

expand all