clear all
clf
set(0,'defaultaxesfontsize',20);
t=-2:.01:2;
Nmax=20;
ik=0;
x=zeros(size(t));
for k=-Nmax:Nmax,
    if k==0, ik=ik+1; c(ik)=0;
    else
        ik=ik+1;
    c(ik)=j*((-1)^k)/(k*pi);
    end
 x=x+c(ik)*exp(j*pi*k*t);
end
figure(1)
plot(t,real(x),'r','linewidth',2)
hold on
xp=[-2 -1 -1 1 1 2];
yp=[0 1 -1 1 -1 0];
%
plot(xp,yp,'linewidth',2)
plot([-2 2],[0 0],'k','linewidth',2);
plot([0 0],[-2 2],'k','linewidth',2);
hold off
figure(2)
stem(-Nmax:Nmax,abs(c),'linewidth',2)



    
