\documentstyle[fullpage,11pt]{article}
\title{Completely-Inessential Matlab}
\author{Student information Processing Board\\Yoav Yerushalmi}
\date{\today}
\begin{document}
\maketitle
\section{What Is This Document?}
This document is meant to be a minor addition to the {\bf Essential Matlab} document. It attempts to answer some of the questions users often ask SIPB members. It is not an introduction to Matlab, and will not help a new user at all. If you would like to learn about Matlab, pick up {\bf Essential Matlab} from the Graphic Arts center --  it's FREE.\\
An alternative is to find the manual online. In an xterm, type:\\
\\
	{\tt help}\\
\\
and look in Documentation Archives ({\sl 13}), Archive of Documents at MIT ({\sl 3}), Matlab on Athena ({\sl 25} - will take a short while).
\section{Questions}
\subsection{Where can I get more info other than the manual?}
Two very good sources for answers before you ask OLC or SIPB are the {\sl Help} and the {\sl OLC commonly asked questions} programs. To get one of these type the following in an xterm:\\
\\
To get {\sl help} Using X (i.e. Workstations at Athena) type\\
{\tt help}\\
{\tt 8}   ---   Numerical and mathematical Software\\
{\tt 2}   ---   Matlab Matrix Manipulation Software\\
\\
To get {\sl OLC commonly asked questions} type\\
{\tt olc answers\\
12}   ---   Matlab Answers\\
\\
From a tty (i.e. dialup)\\
{\tt olh -ttymode}	- will bring up help\\
{\tt olc answers}	- will load the answers.\\
--   same options for the tty as for X.\\
\subsection{How do I get and save my data?}
Matlab has several methods of loading and saving data. If you want to save the data so you can retrieve it next time you use matlab, use the {\tt save [filename]} command. It will save all your matrices and variables, though not your graphs. Then, to retrieve it, use the {\tt load} command.\\
\\
	{\tt save myfile}\\
	or
	{\tt save myfile A B}    ----- to save just matrices A and B\\
	then in the next session:\\
	{\tt load myfile}\\
\\
Some people want to load a plain ASCII text file. For example, if you entered your data with emacs, you may wish to load it as one huge matrix. To do this, the numbers must be listed in rows and columns, with at least one space between every adjacent horizontal element. The numbers must form a rectangle. The filename must end with a {\tt .mat} extension and must have the name you want to give the matrix. For example, {\tt big.mat} will have the data for a variable named {\tt big}. To load it (as matrix {\tt big} in this example), type:\\
\\
{\tt load big}\\ 
\\
To save data in ASCII (plain text) format, save it using the {\tt save [filename] [variable] /ascii} command. For example, to save matrix {\tt A} as ASCII in file {\tt myfile.mat}:\\
\\
{\tt save myfile A /ascii}\\
\\
If you want the numbers to be more precise (16 digits instead of the regular 8) use the {\tt /double} option:\\
\\
{\tt save myfile A /ascii /double}\\
\\
\subsection {How do I save the commands I just typed?}
There are two ways to do save commands you have typed:
\begin{enumerate}
\item You can cut and paste.
\begin{enumerate}
\item Holding the left mouse button down, highlight the text you want saved.
\item In an xterm, type {\tt cat >[filename]} -  where filename is the file you want to save as.
\item In the same xterm, click the middle mouse button (on two button mice, hold down both buttons).
\item Hit {\tt CTRL-D}.
\end{enumerate}
\item Or you can make a diary:
\begin{enumerate}
\item When you want the log to start, type {\tt diary [filename]}  ---  where filename is the file you want to save as.
\item Use Matlab as you would normally.
\item When you are done logging, type {\tt diary off}, and the file will have been saved in the current directory.
\item If you wish to continue the log later, type {\tt diary on}, and the log will continue in the same file.
\end{enumerate}
\end{enumerate}
\subsection {How do I plot my list of numbers?}
Assuming you have your list of numbers as a 1 column matrix, do the following. (I am using A as the matrix name, replace it with the name you used.)\\
\\
{\tt plot (1:length(A), A)}
\subsection {How do I plot one column against the other?}
If I had text oriented like this:\\
\begin{tabular}{ll}
\\
50& 10\\
23& 3\\
45& 20\\
10& 14\\
28& 34.2\\
\\
\end{tabular}
and was interested in graphing the first column vs. the second, I would do the following. (It is reccomended that you load one in as vector A, and the other as B, but if you can't...) Feel free to use your own variable names. I used {\tt data} for the matrix, {\tt data.mat} as the filename, and a normal plot.\\
\\
{\tt load data}        ---   will load the data.\\
{\tt A=length(data)}   ---   will find out the value of the data\\
{\tt plot(data(1:A,1),data(1:A,2))}   ---   will plot the value's using a line graph.
\subsection{How do I label or put text on parts of my graph?}
Please read the {\sl Essential Matlab} document first, as it describes the {\tt title, xlabel,} and {\tt ylabel} commands. If you wish to label a part of the graph that is not supported by those commands, use the {\tt gtext ('text')} command. This will allow you to place the text specified in quotes anywhere on the window using the mouse to position it.
\subsection{I need grid lines on my graph}
type {\tt grid}
\subsection {How do I use this or that function?}
The easiest way to find out how to use a function in Matlab is to type {\tt help [function-name]}. For example, if I don't know how to use {\tt plot}, I would type:\\
\\
{\tt help plot}\\
\\
and some information about the function, as well as related functions (such as {\tt xlabel, mesh, contour} etc.) will be listed.\\
If the help page does not offer enough information, look around in the cluster for a manual. It may be labeled {\sl Pro-Matlab}. Otherwise, come into the SIPB office (W20-557) or call x3-7788 and ask us or use our manuals. OLC also offer answers (though they may take a while to answer). Type {\tt olc} in your xterm to ask them a question.
\subsection {How do I prevent the header page from printing?}
To prevent the header page from printing, you have to issue some commands in your xterm.BEFORE you run matlab, type the following:\\
\\
{\tt setenv LPROPT "-h"}
\\
You can also ask to receive a zephyr (a nice message in a window) when the printing is done.:\\
\\
{\tt setenv LPROPT "-z"}\\
or\\
{\tt setenv LPROPT "-z -h"}\\
for both options.
\subsection {ARGHH!!!  where is my graph!?!?!}
Well, assuming you have done everything right, and the graph doesn't appear, a few possible solutions are:\\
\begin {itemize}
\item {\tt shg}   ---   will try to reshow the last graph made
\item make sure you haven't just plotted something all on one point, those are hard to see, but are there.
\item if you specified the graph scale, make sure it contains the graph.
\item make sure the variable has the right data, type the variable-name to see what is in it.
\end {itemize}
\subsection {I get an error whenever I try to save my graph (or file)}
Unfortunately, graphs have a tendency to be HUGE on disk usage. Quota is usually enough for most things, but you may have run out. Graphs with many points in them can take a meg or more of quota. To check how you are doing with your quota, type {\tt quota -v}. If you think you are going over quota, do the following:
\begin{itemize}
\item type {\tt purge} and then {\tt yes}.
\item refer to the {\sl olc answers} to find out about other methods of maintaining quota.
\end {itemize}
If all else fails, then a very temporary solution is to put the file in {\tt /usr/tmp/}. Save the file normally, but call it\\
{\tt /usr/tmp/[filename]}\\
Whenever you need to use a command on it, type {\tt /usr/tmp/[filename]} instead of just {\tt [filename]}.\\
{\bf WARNING!} {\tt /usr/tmp/[filename]} has many disadvantages. Firstly, {\tt /usr/tmp/[filename]} is not stored in the same place as all your files are. It is stored on the machine you are using. Furthermore, the file is deleted automatically after you logout. This means that you cannot share the file with other people. You cannot use the file when you log in again on another machine. It is a very temporary solution only reccomended for printing out graphs you do not really want to save, but need to store somewhere temporarily.
\subsection{Are values such as $\pi$ available?}
No math program is complete without these values. Here are some of them:
\begin{itemize}
\item $\pi$ = pi
\item $\infty$ = Inf
\item $\sqrt{-1}$ = i , j
\item time = clock
\item date = date
\end{itemize}
\subsection{I need to plot differential equations}
Although Matlab can be used to plot such functions and find roots and intersections, Maple, also available on Athena, is much more recomended. If you still desire to use Matlab, please come into the SIPB office or look at the manuals.
\subsection{What other commands are available?}
Although looking at the manual is probably the best way to learn about all the commands. if you have some time on your hands, type\\
\\
{\tt help}\\
\\
This will list out all the available commands.
\section {Summary of Main commands}
\subsection {not done yet...}




\end{document}
