MATLAB: How to make a symbolic matrix

MATLABmatrixsymbolic

I need to make a symbolic matrix:
1 t1 t1^2 sin(t1) cos(t1)
1 t2 t2^2 sin(t2) cos(t2)
....
1 tm tm^2 sin(tm) cos(tm)
I could make an array of array but not a whole matrix:
# phi.m file
function[result] = phi(t)
% declaring omega
omega = 4;
result = [1 t t*t sin(omega*t) cos(omega*t)];
# main.m file
n=8;
m=5;
t = sym('t',[n,1]);
F = diag(sym('t',[1 m]));
for i=1:n
F(i,:) = phi(t(i));
end
F
and this returns:
[ 1, t1, t1^2, sin(4*t1), cos(4*t1)]
[ 1, t2, t2^2, sin(4*t2), cos(4*t2)]
[ 1, t3, t3^2, sin(4*t3), cos(4*t3)]
[ 1, t4, t4^2, sin(4*t4), cos(4*t4)]
[ 1, t5, t5^2, sin(4*t5), cos(4*t5)]
[ 1, t6, t6^2, sin(4*t6), cos(4*t6)]
[ 1, t7, t7^2, sin(4*t7), cos(4*t7)]
[ 1, t8, t8^2, sin(4*t8), cos(4*t8)]
But it is array of arrays (but I need matrix). How to do this?

Best Answer

What data class does it think that F is?
cell2mat might work.