function s = unitsquare(t)
%UNITSQUARE Square wave generation.
%   UNITSQUARE(T) generates a square wave with period 1 and
%   amplitude 1 for the elements of time vector T.
%
% Compute values of t normalized to (0,1)
tmp = mod(t+eps^0.75,1);		% add a small number, still more than large
								% enough to overcome ambiguity

% Assign 1 values to normalized t between (0,0.5), 0 elsewhere
nodd = (tmp < 0.5);

% The actual square wave computation
s = 2*nodd-1;
