http://i40.tinypic.com/20k61sm.jpg

I'm trying to plot the above fourier series coefficients, what am I doing wrong? here is my matlab code:

Code:`clear`

time=-1:0.01:1;

l=0.5;

x=0; %initialize to 0

for n=1:40

if (n==2*l), x=x-(1/(pi*l)); end;

if (n==(2*l+1)), x=x+(2/((pi*(2*l+1))))*(1+(2*(-1)^l)/(pi*(2*l+1))); end;

plot(time,real(x))

xlabel('time (sec)')

ylabel('x(t)')

title(['n=', int2str(n), ' Fourier Series Approximation'])

pause(1)

end