Once vectors of x -values and y -values have been defi ned, MATLAB makes it easy to create plots. Suppose a set of time versus distance data were obtained through measurement.
We can store the time values in a vector called x (the user can define any con-venient name) and the distance values in a vector called y :
x = [0:2:18];
y = [0, 0.33, 4.13, 6.29, 6.85, 11.19, 13.19, 13.96, 16.33,
To plot these points, use the plot command, with x and y as arguments:
A graphics window automatically opens, which MATLAB calls Figure 1. The resulting plot is shown in Figure 5.1 . (Slight variations in scaling of the plot may occur, depending on the size of the graphics window.)