### 6.2. Two-Dimensional Plots

To draw a 2-D plot in MATLAB, the `plot` command is used. The syntax is given as follows:

where

`x` is a vector containing the x-coordinates of the plot and

`y` is a vector containing the y-coordinates of the plot.

When executed, the command will create a plot in the MATLAB figure window with data in vector `x` taken along x-axis and data in vector `y` along y-axis.

In case figure window already exits, it clears the current figure window and draws a new plot.

##### Example 6.1.

Plot the curve given by equation `y = x`^{2} where x varies from 0 to 10.
Solution:
The program to plot the curve given by equation `y = x`^{2} is given as follows:
x = 0 : 1 : 10; %Statement 1
y = x .^ 2; %Statement 2
plot(x, y); %Statement 3
Statement ... |