|
Department of Engineering |
|
|
Next: Interpolation
Up: Examples
Previous: Displaying Surfaces
Suppose that you have a text file of data (called foo, say)
produced by another program.
The data is in 4 columns. The 1st column contains x coordinates and the
other columns contain 3 sets of y coordinates. You want to display
3 lines on a graph.
First, remove from foo any title headings, etc. Then type
'load foo -ascii' (type 'help load' for more info). This
creates a matrix called foo. To check that the matrix has the
expected number of rows and columns you can type size(foo).
The following command will now produce the required graph.
plot(foo(:,1),foo(:,2), foo(:,1),foo(:,3), foo(:,1),foo(:,4))