% Periodic Fourier series, -20 < x < 20 

NptsX=5000;          % number of x pts             
x=linspace(0,0.4,NptsX);

f1=zeros(1,NptsX);
for n=1:1000
    b(n)=200*(1-cos(n*pi))/(n*pi);  % Fourier sine coefficients
    fn=b(n)*sin((n*pi*x)/10);  % Fourier function(n)
    f1=f1+fn;
end

set(gca,'FontSize',16);
plot(x,f1,'m-','LineWidth',1.5);
hold on
plot([0,0.4],[100,100],'r-','LineWidth',1.5);
xlabel('$x$','FontSize',16,'FontName',fontlabs, ...
    'interpreter','latex');  
ylabel('$y$','FontSize',16,'FontName',fontlabs, ...
    'interpreter','latex'); 
axis on; grid;

print -depsc gibb_d.eps
