clear all; close all;

x = linspace(-5,5,1000);
f = 3/8*ones(1,1000);

for n=1:100
    f = f - 1/(n*pi)*sin(n*pi*x) + (1/(n*pi))^2*(cos(n*pi)-1)*cos(n*pi*x);
end
plot(x,f)
grid on
