No, that code cannot be correct, as it tries to index with the variable "i" that you have not defined. The default value for the variable named "i" happens to be sqrt(-1) which is something you cannot index by.
You should be using
syms i
and listing i in your symsum(), in the form
symsum(EXPRESSION, i, 1, n)
However! A recent posting explored that you cannot index by a symbolic variable. So you should not be using symsum(). You should be using regular sum()
For example,
symsum(beta*x(i)^alpha*exp(lambda*x(i)),1,n)
but
sum(beta .* x.^alpha .* exp(lambda .* x))
