%%  File:  programmingGuide.tex
%%
%%  Study Guide for Numerical Methods with MATLAB
%%  Chapter on "MATLAB Programming"
%%
%%  Gerald Recktenwald,  gerry@me.pdx.edu
%%  August 2000


\documentclass{article}

\usepackage{studyGuide}
\renewcommand{\guideName}{Study Guide for \MATLAB\ Programming}


\title{Study Guide for\\
       \MATLAB\ Programming}
\author{Gerald Recktenwald}


\begin{document}
%\maketitle

% -------------------------
\section*{Bare Essentials}
At the end of this chapter you should be able to
\begin{enumerate}
    \item   Edit and run an m-file (both functions and scripts).
    \item   Identify the key differences between scripts and functions.
    \item   Create a function with one, two or more input parameters and
            one, two or more output parameters.
    \item   Use comment statements to add documentation to scripts and functions.
    \item   Use \texttt{disp} to print a string and a matrix to the command window.
    \item   Use relational operators (\texttt{<}, \texttt{<=}, \texttt{>}, \texttt{>=}, \verb|~=|),
            and logical operators (\verb|&|, \texttt{|}, \verb|~|).
    \item   Use \texttt{if\ldots end}, \texttt{if\ldots elseif\ldots end},
            and \texttt{if\ldots elseif\ldots else\ldots end} constructs.
    \item   Write a \texttt{for} loop to access each element of a vector of arbitrary length.
    \item   Use a \texttt{while} loop to iterate until a convergence tolerance is met.
    \item   Know the difference between \texttt{break} and \texttt{return}, and know
            how and where to use each.
    \item	Use \texttt{disp} to print string messages from within an m-file
    \item	Use \texttt{disp} to print the values in vectors and matrices from within an m-file
\end{enumerate}



% -------------------------
\section*{An Expanded Core of Knowledge}
After mastering the bare essentials you should move on to a deeper understanding
of the fundamentals.  Doing so involves being able to
\begin{enumerate}
    \item   Use \texttt{fprintf} for formatted output.
    \item   Use a one-line \texttt{if\ldots end} construct.
    \item   Write functions having variable numbers of input and output arguments.
    \item   Use a \texttt{switch} construct.
    \item   Preallocate memory for matrices, and know why and when this is advantageous.
    \item   Replace basic loops with vectorized statements.
    \item   Use colon notation to perform vectorized copy operations.
    \item   Use \texttt{feval}.  Know how to pass a function name as an input parameter
            to another function.
\end{enumerate}


% -------------------------
\section*{Developing Mastery}
Working toward mastery of solving systems of equations you will need to
\begin{enumerate}
    \item   Use global variables
    \item   Use array indexing instead of loops to select elements from a matrix.
    \item   Use logical indexing and logical functions instead of loops to select elements from matrix.
    \item	Use \texttt{fprintf} to write data to a file.
    \item   Use \texttt{fprintf} to load data from a file
\end{enumerate}


\end{document}
