I have the next signal
$$x_1[n]= 1 \ |n|\leq N_1; \ 0 \ otherwise$$.
Now I am given some points of sampling of the frequency of the fourier transform of the above signal. \$\omega_0 =\frac{2\pi}{5}\$, and \$\omega=k\omega_0\$ for \$k=-2,-1,0,1,2\$.
Now I am defining a periodic signal \$x_2[n]\$, which is given by:
$$x_2[n]=\sum_{k=-2}^{2} a_k e^{jk 2\pi n /5}$$
Where \$a_k\$ is given by the synthesis formula:
$$a_k=\frac{1}{5} \sum_{-2}^{2} x_1[n] \exp(-jk\frac{2\pi}{5}n)$$
I want to plot \$x_2[n]\$ in the \$n\$ space, but I don't want to calculate the \$a_k\$'s by hand, is there a way to do this by matlab, I mean without writing the full expression in paper and then typing it in matlab?
Is there such functionality?
Thanks in advance.