clear dx = 2*pi/500; x = -pi:dx:pi; figure(1) clf subplot(2,1,1) hold on k = 4; y = sin((k+1/2)*x)./sin(x/2); plot(x,y,'LineWidth',2); k = 3; y = sin((k+1/2)*x)./sin(x/2); plot(x,y,'LineWidth',2); k = 2; y = sin((k+1/2)*x)./sin(x/2); plot(x,y,'LineWidth',2); k = 1; y = sin((k+1/2)*x)./sin(x/2); plot(x,y,'LineWidth',2); axis([-pi,pi,-2.5,10]) title('Dirichlet kernel: N = 1, 2, 3, 4') subplot(2,1,2) hold on k = 4; y = sin((k+1/2)*x)./sin(x/2); plot(x,y); k = 8; y = sin((k+1/2)*x)./sin(x/2); plot(x,y); k = 12; y = sin((k+1/2)*x)./sin(x/2); plot(x,y); k = 16; y = sin((k+1/2)*x)./sin(x/2); plot(x,y); axis([-pi,pi,-10,40]) title('Dirichlet kernel: N = 4, 8, 12, 16') print -dps Dirichlet_kernel.ps % to see what's happening at a particular point I fix a point % xx = -pi + 2*pi*60/500 xx = x(61) % and look at D_n(xx) as a function of n for n=1:500, a(n) = sin((n+1/2)*x(60))./sin(x(60)/2); end figure(2) clf plot(a) xlabel('N','FontSize',16); ylabel('D_N(xx)','FontSize',16); title('fix a point and look at D_N at that point as a function of N');