MATLAB has many nice graphics capabilities. Here, we will illustrate standard two-dimensional plots. First, generate two vectors for plotting

» x = 1:2:11; » z = 5:5:30;

For a standard solid line plot, simply enter

» plot(x,z)

and Figure M1-2 appears. Axis labels are added by selecting “Insert” and specifying X label or Y label. Alternatively, in the command window you can use the following commands (perform this):

» xlabel('x') » ylabel('z')

For more plotting options, type

» help plot

If we wish to plot discrete points, using + as a symbol, we can use the following (perform this):

» plot(x,z,'+') ...

Start Free Trial

No credit card required