clear all;
close all;
N = input('Give the number of terms: ')
a = 0;
b = pi;
x = (-2.5*b:0.005:2.5*b);   
%
y = f(x);
%
sum = 0;
for k =1:N;
    %sum = sum + 4 * (1/(((2*k-1) * pi)^2)) .* cos((2*k-1)*pi*x) + 8 * (1/((4*k-2)*pi)^2) .* cos((4*k-2)*pi*x);
    sum = sum + sin (0.2*b*k) /k .* cos (k*x);
end    
z = 1+10*sum/b;
plot (x,y,x,z,'r')
title(['Number of terms, N = ' int2str(N)],'FontSize',16)
print -depsc fig.eps
%norm(y-z)/norm(y)



