\section{MOD Modulus Operation}

\subsection{Usage}

Computes the modulus of an array.  The syntax for its use is
\begin{verbatim}
   y = mod(x,n)
\end{verbatim}
where \verb|x| is matrix, and \verb|n| is the base of the modulus.  The
effect of the \verb|mod| operator is to add or subtract multiples of \verb|n|
to the vector \verb|x| so that each element \verb|x_i| is between \verb|0| and \verb|n|
(strictly).  Note that \verb|n| does not have to be an integer.  Also,
\verb|n| can either be a scalar (same base for all elements of \verb|x|), or a
vector (different base for each element of \verb|x|).

Note that the following are defined behaviors:
\begin{enumerate}
\item  \verb|mod(x,0) = x|@

\item  \verb|mod(x,x) = 0|@

\item  \verb|mod(x,n)|@ has the same sign as \verb|n| for all other cases.

\end{enumerate}
\subsection{Example}

The following examples show some uses of \verb|mod|
arrays.
\begin{verbatim}
--> mod(18,12)
ans = 
  <double>  - size: [1 1]
 6  
--> mod(6,5)
ans = 
  <double>  - size: [1 1]
 1  
--> mod(2*pi,pi)
ans = 
  <double>  - size: [1 1]
 0  

\end{verbatim}
Here is an example of using \verb|mod| to determine if integers are even
 or odd:
\begin{verbatim}
--> mod([1,3,5,2],2)
ans = 
  <double>  - size: [1 4]
 
Columns 1 to 4
 1  1  1  0  

\end{verbatim}
Here we use the second form of \verb|mod|, with each element using a 
separate base.
\begin{verbatim}
--> mod([9 3 2 0],[1 0 2 2])
ans = 
  <double>  - size: [1 4]
 
Columns 1 to 4
 0  3  0  0  

\end{verbatim}
