\section{RANK Calculate the Rank of a Matrix}

\subsection{Usage}

Returns the rank of a matrix.  There are two ways to use
the \verb|rank| function is
\begin{verbatim}
   y = rank(A,tol)
\end{verbatim}
where \verb|tol| is the tolerance to use when computing the
rank.  The second form is
\begin{verbatim}
   y = rank(A)
\end{verbatim}
in which case the tolerance \verb|tol| is chosen as
\begin{verbatim}
   tol = max(size(A))*max(s)*eps,
\end{verbatim}
where \verb|s| is the vector of singular values of \verb|A|.  The
rank is computed using the singular value decomposition \verb|svd|.
\subsection{Examples}

Some examples of matrix rank calculations
\begin{verbatim}
--> rank([1,3,2;4,5,6])

ans = 

 2 

--> rank([1,2,3;2,4,6])

ans = 

 1 


\end{verbatim}
Here we construct an ill-conditioned matrix, and show the use 
of the \verb|tol| argument.
\begin{verbatim}
--> A = [1,0;0,eps/2]

A = 

    1.0000         0 
         0    0.0000 

--> rank(A)

ans = 

 1 

--> rank(A,eps/8)

ans = 

 2 


\end{verbatim}
