argnames
Input variables of a symbolic function.
Category: Symbolic Computations in MATLAB > Symbolic Variables, Expressions, Functions, and Preferences
Syntax
vars = argnames(f)
Returns the input variables of the symfun f as a row vector.
Description
A symbolic function carries both a formula and the list of variables it depends on. argnames returns that list, which is not always the same as the free variables of the formula: f(x, y) = x^2 still has two arguments.
The companion function formula returns the expression.
Input arguments
f- Symbolic function created with
syms f(x, y)or by assignmentf(x) = expr.
Output arguments
vars- Symbolic row vector with the argument names, in declaration order.
Example
Arguments of a function
syms f(x, y)
f(x, y) = x^2 + y;
argnames(f)
formula(f)
Output
ans =
[x, y]
ans = x^2 + y