Page 18 -
P. 18
nates are called Cartesian coordinates, and any point in the plane can be
described in this manner. We write for the point, P(x, y).
Other representations can also be used to locate a point with respect to a
particular set of axes. For example, in the polar representation, the point is
specified by an r-coordinate that measures the distance of the point from the
origin, while the θ-coordinate measures the angle which the line passing
through the origin and this point makes with the x-axis.
The purpose of the following two examples is to learn how to represent
points in a plane and to plot them using MATLAB.
Example 1.3
Plot the point P(3, 4).
Solution: Enter the following:
x1=3;
y1=4;
plot(x1,y1,'*')
Note that the semicolon is used in the above commands to suppress the
echoing of the values of the inputs. The '*' is used to mark the point that we
are plotting. Other authorized symbols for point displays include 'o', '+',
'x', … the use of which is detailed in help plot.
Example 1.4
Plot the second point, R(2.5, 4) on the graph while keeping point P of the pre-
vious example on the graph.
Solution: If we went ahead, defined the coordinates of R, and attempted to
plot the point R through the following commands:
x2=2.5;
y2=4;
plot(x2,y2,'o')
we would find that the last plot command erases the previous plot output.
Thus, what should we do if we want both points plotted on the same
graph? The answer is to use the hold on command after the first plot.
The following illustrates the steps that you should have taken instead of
the above:
hold on
x2=2.5;
© 2001 by CRC Press LLC