MATLAB Guide

MATLAB has powerful and versatile graphics capabilities. Figures of many types can be generated with relative ease and their "look and feel" is highly customizable. In this chapter we cover the basic use of MATLAB's most popular tools for graphing two- and three-dimensional data; Chapter 17 on Handle Graphics delves more deeply into the innards of MATLAB's graphics. Our philosophy of teaching a useful subset of MATLAB's language, without attempting to be exhaustive, is particularly relevant to this chapter. The final section hints at what we have left unsaid.
Our emphasis in this chapter is on generating graphics at the command line or in M-files, but existing figures can also be modified and annotated interactively using the Plot Editor. To use the Plot Editor see help plotedit and the Tools menu and toolbar of the figure window.
Note that the graphics output shown in this book is printed in black and white. Most of the output appears as color on the screen and can be printed as color on a color printer.
MATLAB's plot function can be used for simple "join-the-dots" x ? y plots. Typing
<span class="unicode">?</span> x = [1.5 2.2 3.1 4.6 5.7 6.3 9.4]; <span class="unicode">?</span> y = [2.3 3.9 4.3 7.2 4.5 3.8 1.1]; <span class="unicode">?</span> plot(x,y)
produces the left-hand picture in Figure 8.1, where the points x(i), y(i) are joined in sequence. MATLAB opens a figure window (unless...