f=prect(L,n);
psinc(L,n) computes the periodic rectangle (or square) function of length L supported on n samples. The dft of the periodic rectangle function in the periodic sinc function, psinc.
This figure displays an odd length periodic rectangle:
stem(prect(30,11)); ylim([-.2 1.2]);
This figure displays an even length periodic rectangle. Notice the border points:
stem(prect(30,12)); ylim([-.2 1.2]);