Page 36 - Basics of MATLAB and Beyond
P. 36

>> s = 100*spiral(3)
                               s  =
                                  700   800    900
                                  600   100    200
                                  500   400    300
                               >> ind = find(s>400)
                               ind  =
                                    1
                                    2
                                    3
                                    4
                                    7
                               >> s(ind)
                               ans  =
                                  700
                                  600
                                  500
                                  800
                                  900
                               >> s(s>400)
                               ans  =
                                  700
                                  600
                                  500
                                  800
                                  900
                               After introducing graphics of functions of two variables in the next sec-
                               tion, we will see how the find command can be used to do the three-
                               dimensional equivalent of the plot shown on page 23, where the domain
                               of a curve satisfying a logical test was extracted.


                               7    Graphics of Functions of Two Variables

                               7.1   Basic Plots
                               A matlab surface is defined by the z coordinates associated with a set
                               of (x, y) coordinates. For example, suppose we have the set of (x, y)
                               coordinates:
                                                                          
                                                        1, 12, 13, 14, 1
                                                        1, 22, 23, 24, 2  
                                              (x, y)=                       .
                                                       1, 32, 33, 34, 3 
                                                        1, 42, 43, 44, 4
                               The points can be plotted as (x, y) pairs:



                               c   2000 by CRC Press LLC
   31   32   33   34   35   36   37   38   39   40   41