Page 116 - A Guide to MATLAB for Beginners and Experienced Users
P. 116

M-Book Graphics          97


                     reevaluate the entire selection by choosing Evaluate Cell. You can reevaluate
                     the entire M-book at any time by choosing Evaluate M-book. If your M-book
                     contains a loop, you can evaluate it by selecting it and choosing Evaluate
                     Loop, or for that matter Evaluate Cell, provided the entire loop is inside a
                     single input cell.
                       It is often handy to purge all output from an M-book before saving, to
                     economize on storage space or on time upon reopening, especially if there
                     are complicated graphs in the document. If there are any input cells that you
                     want to automatically evaluate upon opening of the M-book, select them and
                     click on Define Auto Init Cell. The color of the text in those cells will change.
                     If you want to separate out a series of commands, say for repeated evaluation,
                     then select the cells and click on Define Calc Zone. The commands selected
                     will be encased in a Word section (withsection breaks before and after it). If
                     you click in the section and select Evaluate Calc Zone from the Notebook
                     menu, the commands in only that zone will be (re)evaluated.
                       The last two buttons are also useful. The button Bring MATLAB to Front
                     does exactly that; it reveals the MATLAB Command Window that has been
                     hiding behind the M-book. You may want to enter a command directly into the
                     Command Window (for example, a help entry) and not have it in your M-book.
                     Finally, the last button, Notebook Options brings up a panel in which you
                     can do some customization of your M-book: set the numerical format, establish
                     the size of graphics figures, etc. We find it most useful to decrease the default
                     graphics size — the “factory setting” is generally too large. Decreasing the
                     figure size with Notebook Options may not work withWord 2000, thoughit
                     is still possible to change the size of figures one at a time, by right clicking on
                     the figure and then choosing the “Size” tab from Format Object....


           M-Book Graphics


                     All MATLAB commands that generate graphics work in M-books. The figure
                     produced by a graphics command appears immediately below that command.
                     However, one must be a little careful in planning and executing graphics
                     statements. For example, if in an attempt to reproduce Figure 5-3, you type
                     ezcontour(’xˆ2 + yˆ2’, [-3 3], [-3 3]) and CTRL+ENTER, this will
                                                   2
                                              2
                     yield the level curves of x + y , but they will appear elliptical because you
                     forgot the command axis square. If you enter that command on the next
                     line, you will get a second picture that will be correct. But a much better
                     strategy — and one that we strongly recommend — is to return to the original
                     input cell and edit it by adding a semicolon (or a carriage return) and the axis
   111   112   113   114   115   116   117   118   119   120   121