symfunmatrix
Description
creates the symbolic matrix function f
= symfunmatrix(formula
,inputs
)f
. The symbolic expression
formula
is the body of the function f
that can be
converted to the symmatrix
data type. The variables in
inputs
are the input arguments of the function f
.
If the input arguments of function
f
are multiple variables,inputs
must be a cell array of symbolic scalar and matrix variables.If the input argument of function
f
is a single variable, you can specifyinputs
as a symbolic scalar variable or a symbolic matrix variable.
also explicitly specifies the size of the evaluated symbolic matrix function
f
= symfunmatrix(formula
,inputs
,[nrow ncol]
)f(var1,var2,...)
as nrow
-by-ncol
for the inputs = {var1,var2,...}
.
If
formula
represents an unassigned abstract function, thenf(var1,var2,...)
has the size ofnrow
-by-ncol
. For example:syms x 2 matrix; f = symfunmatrix('g(x)',{x},[3 4]); size(f(x))
ans = 3 4
If
formula
represents a symbolic expression or a function with definition, then the size off(var1,var2,...)
follows the size offormula
. For example:syms X Y 2 matrix; f = symfunmatrix(X*Y - Y*X,{X,Y},[3 3]); size(f(X,Y))
ans = 2 2
Examples
Input Arguments
Output Arguments
Limitations
To show all the functions in Symbolic Math Toolbox™ that accept symbolic matrix functions as input, use the command
methods symfunmatrix
.
Tips
When evaluating a symbolic matrix function, you must substitute values that have the same size as the defined input arguments. For example, see Define and Evaluate Symbolic Matrix Functions. For comparison, this example returns an error:
syms X [2 2] matrix syms f(X) [1 1] matrix keepargs f(ones(4))