clear all
clf
set(0,'defaultaxesfontsize',20);
t=-7.99:.01:7.99;
Nmax=11;
x=zeros(size(t));
ik=0;
for k=-Nmax:Nmax,
    if k==0, ik=ik+1; 
        %c(ik)=0; 
        c(ik)=1/2; 
        %c(ik)=1;
        x=x+c(ik)*ones(size(x)); c(ik)=1/2;
    else
 ik=ik+1;
    %c(ik)=6*(sin(k*pi/6))*(sin(k*pi/2))/(k*pi)^2;
    %c(ik)=9*(1-exp(-j*2*k*pi/3))/(2*k*pi)^2;
    %c(ik)=j*(exp(-j*2*k*pi/3)+exp(-j*4*k*pi/3)-2)/(2*k*pi);
    %c(ik)=j*(-1)^k/(pi*k);
    c(ik)=sin(k*pi/2)/(k*pi);
 %
 x=x+c(ik)*exp(j*2*pi*k*t/6);
    end
end
figure(1)
plot(t,real(x),'linewidth',2)
set(gca,'XTick',[-8:8])
axis([-8 8 -2 2]);
hold on
plot([-8 8],[0 0],'k','linewidth',2);
plot([0 0],[-2 2],'k','linewidth',2);
hold off
%
figure(2)
stem(-Nmax:Nmax,abs(c),'linewidth',2)





    
