You are here

Example 3.1

20 January, 2016 - 09:21

Type in the following statement at the MATLAB prompt:

x=[-pi:.1:pi]; y=sin(x); plot(x,y);

After we executed the statement above, a plot named Figure1 is generated:

media/image2.png
Figure 3.1 Graph of sin(x) 
 

Having variables assigned in the Workspace, x and y=sin(x) in our case, we can also select x and y, and right click on the selected variables. This opens a menu from which we choose plot(x,y). See the figure below .

media/image3.png
Figure 3.2 Creating a plot from Workspace.