formula
Mathematical expression that defines a symbolic function.
Category: Symbolic Computations in MATLAB > Symbolic Variables, Expressions, Functions, and Preferences
Syntax
expr = formula(f)
Returns the body of the symfun f as a plain symbolic expression.
Description
A symfun such as f(x) = x^2 + 1 is more than an expression: it also knows its argument list. formula strips that wrapper and gives the expression, which can then be differentiated, simplified or substituted like any other sym.
When f has been declared but not yet defined, the formula is just the unevaluated call f(x).
Input arguments
f- Symbolic function. A plain sym expression is returned unchanged.
Output arguments
expr- Symbolic expression in the input variables of
f.
Example
Extracting the expression
syms f(x)
formula(f)
f(x) = x^2 + 1;
e = formula(f)
class(e)
Output
ans = f(x)
e = x^2 + 1
ans = 'sym'