clf % Initialization of needed quantities: N = [3,5,7,15]; grid = linspace(-1/4,1/4,1000); onefigure = 1; % Plotting in one or two figures. % Use the sinusoidal form to ascertain that the returned % values are real: D = @(N,x) sin(2*pi*(2*N+1/2).*x)./sin(pi*x); % Plotting: if (onefigure == 0) plot(grid,D(N(1),grid),grid,D(N(3),grid)); legend('N=3','N=7'); xlabel('x'); ylabel('D_N(x)'); figure plot(grid,D(N(2),grid),grid,D(N(4),grid)); legend('N=5','N=15'); xlabel('x'); ylabel('D_N(x)'); else plot(grid,D(N(1),grid),grid,D(N(2),grid),... grid,D(N(3),grid),grid,D(N(4),grid)); legend('N=3','N=5','N=7','N=15'); xlabel('x'); ylabel('D_N(x)'); end