function gibbs
%N = input('  Number of terms in the Series    = ');
%NN= 2*N-1;
%npoints=101;
%jx       = linspace(0,pi,npoints);
%jjhhsum = zeros(size(x));
%ana = ones(size(x));
%for ind=1:2:NN
%    sum = sum+sin(ind*x)/ind;
%end
%jjhsum = 4*sum/pi;
%plot(x,sum,'r',x,ana,'b');


N=5;
NN= 2*N-1;
npoints=101;
x       = linspace(0,pi,npoints);
sum = zeros(size(x));
ana = ones(size(x));
for ind=1:2:NN
    sum = sum+sin(ind*x)/ind;
end
sum1 = 4*sum/pi;

N=20;
NN= 2*N-1;
npoints=101;
x       = linspace(0,pi,npoints);
sum = zeros(size(x));
ana = ones(size(x));
for ind=1:2:NN
    sum = sum+sin(ind*x)/ind;
end
sum2 = 4*sum/pi;

N=50;
NN= 2*N-1;
npoints=101;
x       = linspace(0,pi,npoints);
sum = zeros(size(x));
ana = ones(size(x));
for ind=1:2:NN
    sum = sum+sin(ind*x)/ind;
end
sum3 = 4*sum/pi;

plot(x,ana,'k',x,sum1,'r',x,sum2,'g',x,sum3,'b');
