MATLAB: Matrix with symbolic expression

MATLABsymbolic

Can anyone help me fix my codes ? I want to generate a vector with symbolic expressions:
N=5;
alpha=0.7;
g=zeros(N,1);
syms w
for k=1:N
g(k)=k*w^(alpha/(alpha-1));
end
When I run the codes, it turned out
??? The following error occurred converting from sym to double:
Error using ==> mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.

Best Answer

If you are creating a symbolic array, then do not initialize it with 0, as 0 is not symbolic.
g = repmat(sym(0), N, 10);