syms t

t0 = 0;
T = 3;
w = 2*pi/T;

x = exp(-t);
%plot(x,[t0 t0+T]);

for k = -40:40
    a(k+41)=(1/T)*int(x.*exp(-1i*k*w*t),t,t0,t0+T);
end
for k=-40:40
    ex(k+41)=exp(1i*k*w*t);
end
xx = sum(a.*ex);
r=corrcoef(a);
ezplot(xx,[t0 t0+T])

for k=-5:5
    a(k+6)=(1/T)*int(x.*exp(-1i*k*w*t),t,t0,t0+T);
end
for k=-5:5
    ex(k+6)=exp(1i*k*w*t);
end
xx = sum(a.*ex);
ezplot(xx,[t0 t0+T]);