function rect_y = rect(xx) [M,N] = size(xx); rect_y = zeros(M,N); rect_y(abs(xx)<1/2) = 1; rect_y(abs(xx) == 1/2) = 1/2; end