Page 27 -
P. 27

1.7.1.1  Demonstration: Plotting Multiple Figures within a Figure
                                      Window
                             Using the data obtained in the previous example, observe the difference in
                             the partition of the page in the following two sets of commands:

                                subplot(2,1,1)
                                plot(x,y1)
                                subplot(2,1,2)
                                plot(x,y2)

                             and

                                clf
                                subplot(1,2,1)
                                plot(x,y1)
                                subplot(1,2,2)
                                plot(x,y2)


                             1.7.2  More on Parametric Plots in 2-D
                             In the preceding subsection, we generated the x- and y-arrays by first writing
                             the x-variable as a linear function of a parameter, and then expressed the
                             dependent variable y as a function of that same parameter. What we did is
                             that, instead of thinking of a function as a relation between an independent
                             variable x and a dependent variable y, we thought of both x and y as being
                             dependent functions of a third independent parameter. This method of curve
                             representation, known as the parametric representation, is described by (x(t),
                             y(t)), where the parameter t varies over some finite domain (t min , t max ). Note,
                             however, that in the general case, unlike the examples in the previous chapter
                             subsection, the independent variable x need not be linear in the parameter,
                             nor is the process of parametrization unique.

                             Example 1.11
                             Plot the trigonometric circle.

                             Solution: Recalling that the x-coordinate of any point on the trigonometric
                             circle has the cosine as x-component and the sine as y-component, the gener-
                             ation of the trigonometric circle is immediate:

                                th=linspace(0,2*pi,101)
                                x=cos(th);
                                y=sin(th);


                             © 2001 by CRC Press LLC
   22   23   24   25   26   27   28   29   30   31   32