## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

### 6.2. Two-Dimensional Plots

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

```plot(x, y)
```

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 = x2 where x varies from 0 to 10. Solution: The program to plot the curve given by equation y = x2 is given as follows: ```x = 0 : 1 : 10; %Statement 1 y = x .^ 2; %Statement 2 plot(x, y); %Statement 3 ``` Statement ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required