clear all
clf
set(0,'defaultaxesfontsize',20);
t=-6:.01:6;
Nmax=20;
ik=0; eps=0.0000001
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);
    % c(ik)=(5*j)/(k*2*pi);
    c(ik)=0.5*j*((sin((k+2+eps)*pi/2)/((k+2+eps)*pi))-(sin((k-2+eps)*pi/2)/((k-2+eps)*pi)));
    end
 x=x+c(ik)*exp(j*2*pi*k*t/4);
end
figure(1)
plot(t,real(x),'r','linewidth',2)
hold on
xp=[-1 -1 -1 1 1 2];
yp=[0 1 -1 1 -1 0];
%
%plot(xp,yp,'linewidth',2)
plot([-6 6],[0 0],'k','linewidth',2);
plot([0 0],[-2 2],'k','linewidth',2);
hold off
figure(2)
stem(-Nmax:Nmax,abs(c),'linewidth',2)



    
