\section{REPMAT Array Replication Function}

\subsection{Usage}

The \verb|repmat| function replicates an array the specified
number of times.  The source and destination arrays may
be multidimensional.  There are three distinct syntaxes for
the \verb|repmap| function.  The first form:
\begin{verbatim}
  y = repmat(x,n)
\end{verbatim}
replicates the array \verb|x| on an \verb|n-times-n| tiling, to create
a matrix \verb|y| that has \verb|n| times as many rows and columns
as \verb|x|.  The output \verb|y| will match \verb|x| in all remaining
dimensions.  The second form is
\begin{verbatim}
  y = repmat(x,m,n)
\end{verbatim}
And creates a tiling of \verb|x| with \verb|m| copies of \verb|x| in the
row direction, and \verb|n| copies of \verb|x| in the column direction.
The final form is the most general
\begin{verbatim}
  y = repmat(x,[m n p...])
\end{verbatim}
where the supplied vector indicates the replication factor in 
each dimension.  
\subsection{Example}

Here is an example of using the \verb|repmat| function to replicate
a row 5 times.  Note that the same effect can be accomplished
(although somewhat less efficiently) by a multiplication.
\begin{verbatim}
--> x = [1 2 3 4]

x = 

 1 2 3 4 

--> y = repmat(x,[5,1])

y = 

 1 2 3 4 
 1 2 3 4 
 1 2 3 4 
 1 2 3 4 
 1 2 3 4 


\end{verbatim}
The \verb|repmat| function can also be used to create a matrix of scalars
or to provide replication in arbitrary dimensions.  Here we use it to
replicate a 2D matrix into a 3D volume.
\begin{verbatim}
--> x = [1 2;3 4]

x = 

 1 2 
 3 4 

--> y = repmat(x,[1,1,3])

y = 

(:,:,1) = 

 1 2 
 3 4 

(:,:,2) = 

 1 2 
 3 4 

(:,:,3) = 

 1 2 
 3 4 


\end{verbatim}
