%% Create Symbolic Functions with Matrices as Formulas
% Create a symbolic function and specify its formula by using a symbolic matrix.

syms x
M = [x x^3; x^2 x^4];
f(x) = M

% Compute the function value at the point x = 2:

f(2)

% Compute the value of this function for x = [1 2 3; 4 5 6]. The result is a cell array of symbolic matrices.

xVal = [1 2 3; 4 5 6];
y = f(xVal)

% Access the contents of a cell in the cell array by using braces.

y{1}

%
% Copyright 2019 The MathWorks, Inc.