MATLAB: Subscript – Symbolic serie

MATLABsumsymbolic

Hello everyone. Is it possible to create a symbolic serie like this: a_0, a_1, a_2, a_3? I tried with the following wrong code:
close all
clear all
syms a n
x=symsum(a_{n},n,0,3)
Thank you very much.

Best Answer

a = [sym('a_0'), sym('a_%d', [1, 3])];
However, it is not possible to use a symbolic variable to index anything; in particular, the symbolic index, n, in symsum() cannot be used to index anything. You need to construct the individual terms and add them up, such as
x = sum( a .^ (1:4) )