MATLAB: Creating a symbolic array

arrayexpressionfunctionsubssymbolic

When I tried to create an array consisting of expressions in terms of a symbolic variable I get the error message
Unable to convert expression containing symbolic variables into double array. Apply 'subs' function first to substitute values for variables.
But I don't want to evaluate the expressions at a particular value. Instead I want expressions in terms of the symbolic variable q. Does anyone have suggestions regarding how this can be done?
syms q
a = [];
for i = 1:5
for j = 1:5
a(i,j) =q;
end
end

Best Answer

a = sym([]);
or better yet
a = zeros(5,5,'sym')
Related Question