% PLOTDN   Plot the Dirichlet kernel
%    D_N(u) = (1/2)  +  \sum_{n=1}^N  cos(n u)


N = 10;

u = linspace(-pi,pi,2001);
y = 0.5 * ones(size(u));
for n=1:N
    y = y + cos(n*u);
end

plot(u,y)
title(['D_{' int2str(N) '}(u)'])
xlabel u