symfunmatrix
Create symbolic matrix function
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
,
which must be a cell array of symbolic scalar and matrix variables.
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
Differentiation functions, such as
divergence
,curl
,jacobian
, andlaplacian
, currently do not accept symbolic matrix functions as input. To evaluate differentiation with respect to vectors and matrices, use thediff
function instead.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))
Version History
Introduced in R2022a