You don’t have to use Mathcad to generate the vectors that you plot, as was done for the example in Figure 20-5. You can create vectors by reading in data from a data file, by pasting in the data from the clipboard, or by typing data directly into an input table.
These techniques are described in Chapter 19, “Data Management.” Once you create vectors from data-for example, by extracting columns from a matrix-you can plot the vectors just as you would plot any vectors, as discussed in the previous section. See Figure 20-7 for an example of plotting vectors from data imported from an external file.
Graphing other expressions
The examples in Figure 20-2 through Figure 20-7 show some of the most common types of graphs. However, graphs are not limited to these examples. You can graph any expression against any other expression, as long as they share the same range variables. For example, see Figure 20-12 for an example of graphing a constant to be used as a marker on the graph of another function.
You can graph several traces on the same graph. A graph can show several y-axis expressions against the same x-axis expression, or it can match up several y-axis expressions with corresponding x-axis expressions. One way to graph several expressions is to create a QuickPlot as described in the first section of this chapter.
Alternatively, you can graph several y-axis expressions versus one x-axis expression, using a conventional graph. To do so, choose GraphesX. Y Plot from the Insert menu and enter the first y-axis expression in the y-axis placeholder followed by a comma.
You’ll see a placeholder immediately below this first expression. Enter the second expression here, followed by another comma to get another empty placeholder. Enter the next expression. All the expressions should use the same range variable, as shown in Figure 20-8.
To graph several independent curves on the same set of axes, enter two or more expressions separated by commas on the x-axis and the same number of expressions on the y-axis. Mathcad matches up the expressions in pairs-fIrst x-axis expression with first y-axis expression, the second with the second, and so on. It then draws a trace for each pair. Each matching pair of expressions should use the same range variable.
The range variable for one pair need not match the range variables for the other pairs. You can plot up to 16 arguments on the y-axis against 1 argument on the x-axis. Figure 20-9 shows an example in which the range variables differ for each pair.
Note however, that all traces on a graph share the same axis limits. For each axis, all expressions and limits on that axis must have compatible units.