next up previous contents
Next: Arithmetic operations on matrices Up: Simple calculations and graphs Previous: Entering vectors and matrices;

Graphs

The simplest graphs to create are plots of points in the cartesian plane. For example:

>> x = [1;2;3;4;5];
>> y = [0;.25;3;1.5;2];
>> plot(x,y)
The resulting graph is displayed in Figure 1.

   figure32
Figure 1: A simple Matlab graph

Notice that, by default, Matlab connects the points with straight line segments. An alternative is the following (see Figure 2):

>> plot(x,y,'o')

   figure39
Figure 2: Another simple Matlab graph



Mark S. Gockenbach
Wed Sep 8 10:44:13 EDT 1999