1. Matlab help facilities

1.1 Inline help
1.2 Web based support and help
1.3 Who, whos and clear
1.4 Recording you Matlab session

Matlab provides excellent online help. Just try to be a little creative and you can find help on almost anything Matlab can do.

1.1 Inline help

Type help to find a list of Matlab help topics

>> help

HELP topics:

eyre/matlab          -  Eyre functions - generally for differential equations
matlab/general       -  General purpose commands.
matlab/ops           -  Operators and special characters.
matlab/lang          -  Programming language constructs.
matlab/elmat         -  Elementary matrices and matrix manipulation.
matlab/elfun         -  Elementary math functions.
matlab/specfun       -  Specialized math functions.
matlab/matfun        -  Matrix functions - numerical linear algebra.
matlab/datafun       -  Data analysis and Fourier transforms.
matlab/polyfun       -  Interpolation and polynomials.
matlab/funfun        -  Function functions and ODE solvers.
matlab/sparfun       -  Sparse matrices.
matlab/graph2d       -  Two dimensional graphs.
matlab/graph3d       -  Three dimensional graphs.
matlab/specgraph     -  Specialized graphs.
matlab/graphics      -  Handle Graphics.
matlab/uitools       -  Graphical user interface tools.
matlab/strfun        -  Character strings.
matlab/iofun         -  File input/output.
matlab/timefun       -  Time and dates.
matlab/datatypes     -  Data types and structures.
matlab/demos         -  Examples and demonstrations.
simulink/simulink    -  Simulink 
simulink/blocks      -  Simulink block library.
simulink/simdemos    -  Simulink demonstrations and samples.
simulink/dee         -  Differential Equation Editor
toolbox/compiler     -  MATLAB Compiler
toolbox/control      -  Control System Toolbox.
control/obsolete     -  (No table of contents file)
toolbox/ident        -  System Identification Toolbox.
images/images        -  Image Processing Toolbox.
images/imdemos       -  Image Processing Toolbox --- demos and sample images
toolbox/local        -  Preferences.
toolbox/optim        -  Optimization Toolbox. 
toolbox/signal       -  Signal Processing Toolbox.
stateflow/stateflow  -  Stateflow
stateflow/sfdemos    -  (No table of contents file)
toolbox/symbolic     -  Symbolic Math Toolbox.
toolbox/tour         -  MATLAB Tour

For more help on directory/topic, type "help topic".

To see the graphics subsection, type

>> help graph2d

  Two dimensional graphs.
  Elementary X-Y graphs.
    plot      - Linear plot.
    loglog    - Log-log scale plot.
    semilogx  - Semi-log scale plot.
    semilogy  - Semi-log scale plot.
    polar     - Polar coordinate plot.
    plotyy    - Graphs with y tick labels on the left and right.
  Axis control.
    axis      - Control axis scaling and appearance.
    zoom      - Zoom in and out on a 2-D plot.
    grid      - Grid lines.
    box       - Axis box.
    hold      - Hold current graph.
    axes      - Create axes in arbitrary positions.
    subplot   - Create axes in tiled positions.
    daspect   - Data aspect ratio.
    pbaspect  - Plot box aspect ratio.
    xlim      - X limits.
    ylim      - Y limits.
  Graph annotation.
    legend    - Graph legend.
    title     - Graph title.
    xlabel    - X-axis label.
    ylabel    - Y-axis label.  
    text      - Text annotation.
    gtext     - Place text with mouse.
    plotedit  - Experimental graph editing and annotation tools.
  Hardcopy and printing.
    print     - Print graph or SIMULINK system; or save graph to M-file.
    printopt  - Printer defaults.
    orient    - Set paper orientation. 

To see the help for a standard plot of (x,y) data

>> help plot

 PLOT   Linear plot. 
    PLOT(X,Y) plots vector Y versus vector X. If X or Y is a matrix,
    then the vector is plotted versus the rows or columns of the matrix,
    whichever line up. 
    PLOT(Y) plots the columns of Y versus their index.
    If Y is complex, PLOT(Y) is equivalent to PLOT(real(Y),imag(Y)).
    In all other uses of PLOT, the imaginary part is ignored.
    Various line types, plot symbols and colors may be obtained with
    PLOT(X,Y,S) where S is a character string made from one element
    from any or all the following 3 colunms:
           y     yellow        .     point              -     solid
           m     magenta       o     circle             :     dotted
           c     cyan          x     x-mark             -.    dashdot 
           r     red           +     plus               --    dashed   
           g     green         *     star
           b     blue          s     square
           w     white         d     diamond
           k     black         v     triangle (down)
                               ^     triangle (up)
                               <     triangle (left)
                               >     triangle (right)
                               p     pentagram
                               h     hexagram
    For example, PLOT(X,Y,'c+:') plots a cyan dotted line with a plus 
    at each data point; PLOT(X,Y,'bd') plots blue diamond at each data 
    point but does not draw any line.
    PLOT(X1,Y1,S1,X2,Y2,S2,X3,Y3,S3,...) combines the plots defined by
    the (X,Y,S) triples, where the X's and Y's are vectors or matrices 
    and the S's are strings.  
    For example, PLOT(X,Y,'y-',X,Y,'go') plots the data twice, with a
    solid yellow line interpolating green circles at the data points.
    The PLOT command, if no color is specified, makes automatic use of
    the colors specified by the axes ColorOrder property.  The default
    ColorOrder is listed in the table above for color systems where the
    default is yellow for one line, and for multiple lines, to cycle
    through the first six colors in the table.  For monochrome systems,
    PLOT cycles over the axes LineStyleOrder property.
    PLOT returns a column vector of handles to LINE objects, one
    handle per line. 
    The X,Y pairs, or X,Y,S triples, can be followed by 
    parameter/value pairs to specify additional properties 
    of the lines.

The first paragraph states that to see a plot of (x,y) data pairs, type plot(x,y) where x and y are vectors of data. Cut and paste the following into your Matlab window.

>> x = 1:4
>> y = rand(4,1)
>> plot(x,y)

For window based help, from the Matlab prompt type helpwin. This accesses the same help data that you have just been working with.

A special note about help.

If you look at the help page for plot, it says
    PLOT(X,Y) plots vector Y versus vector X.
but what it means is that you should type PLOT(.,.) in lower case letters, i.e. type
>> plot(x,y)
The help pages use capitals to set the Matlab commands apart from other text. Just remember, Matlab commands are issued in lower case.

1.2 Web-based help

From the Matlab prompt, type

This access the Matlab help page that is part of the installed version of Matlab.

Help and software are available at the Matlab home page


Finally, there is a newsgroup on Usenet, comp.soft-sys.matlab, that is devoted to Matlab. Reading and participating in the group is a good way to improve your Matlab skills.

1.3 Who, whos and clear

These Matlab commands are extremely useful to determine the available Matlab variables, and to clear those variables. Type help who, or better yet type

>> who
>> whos
>> clear
>> who

1.4 Recording you Matlab session

The Matlab commands you issue and the results you obtain can be saved to a disk file containing ascii data. To save the data type

>> diary foo
This records your Matlab session in a disk file named foo. This can be particularly useful for homework you wish to turn in, just save the results of your calculations, and use a text editor to include the necessary commenting.

David Eyre