Help and other tools
Places to get help:
- Typing "help" at the matlab prompt
gives you a list of all the possible directories matlab can find
commands in (which also tells you its "search path", or a list of the
directories it is looking in for commands.)
- Typing "help directoryname" gives you a list of the commands in that directory and a short description of them.
- Typing "help commandname" gives you help on a specific command.
- Typing "lookfor keyword" gives you a list of commands that use
that keyword. ie, "lookfor integral" lists commands that deal with
integrals. It's pretty slow, choose the word wisely. You can use
control-c to stop searching when you think you've found what you need.
- Typing "doc" starts up a web browser with the Matlab on Athena
home page. This includes the entire reference manual for matlab, a whole
lot of other information on using matlab, and a pointer to the Matlab
Primer, a good introduction to using Matlab.
- You can get copies of "Matlab on Athena" at Graphic Arts. You can
also get copies of the Matlab Primer mentioned above. (There's a small
fee for copying costs on both.)
- The matlab manual and manuals for many of the toolboxes are
available in some clusters and can be borrowed from the consultants'
office in 11-115.
Some Useful Tools:
- If you accidentally reassign a function name to a variable
(ie, you try saying sum = 3 and then you get errors when you try to
use the sum function because it doesn't know it's a function anymore),
you can restore it to its normal state using "clear functionname".
You can also use clear to get rid of all variable values with "clear
all".
-
who
will tell you all the variables you have currently defined.
-
whos
will tell you the variables, their sizes, and some other info.
-
pi
is a function of that returns the value of pi.
-
eps
is a function that returns Matlab's smallest
floating point number. This is useful if you have a vector that might
contain zeros that is going to wind up in the denominator of
something. If you add eps to the vector, you aren't actually adding
anything significant, but you won't run into divide by zero problems
anymore.
format long
and format short
switch between
the long and short display format of numbers. Either way matlab uses
the same number of digits for its calculations, but normally (format
short) it will only display the first four digits after the decimal
point.
- Typing
type
functionname for any function in Matlab's search path lets you see how that function is written.