Creating a contour plot
To create a contour plot:
• Define a matrix of values to plot. Mathcad will assume that the rows and columns represent equally spaced intervals on the axes. Mathcad then linearly interpolates the values of this matrix to form level curves. Such level curves can represent isotherms, isobars, equipotentials, streamlines, and many other physical phenomena.
• Choose Graphee Contour Plot from the Insert menu. Mathcad shows a box with a single placeholder as shown below:
• Type the name of the matrix in the placeholder. Just as with an equation, Mathcad will not process the contour plot until you click outside the region. What you see is a visual representation of the matrix’s level curves. Each level curve, or contour, is formed in such a way that no two cross. By default, the contours are labeled with their height above or below the xy plane. Mathcad plots the matrix by rotating it so that the (0,0) element is at the lower-left comer. Thus the rows of the matrix correspond to values on the x-axis, increasing to the right, and the co]urnns correspond to values along the y-axis, increasing toward the top.
You can specify whether or not the contours are to be numbered, how many contours there are, and what labels and grid lines appear on the axes by formatting the contour plot. This is described in “Formatting contour plots”.
Level curves of a function of two variables
A typical contour plot shows the level curves of a function of two variables. To see such a plot, you must first create a matrix that holds the values of the function, then create a contour plot of that matrix. Here are the typical steps in plotting a function of two variables.
• Define a function of two variables.
• Decide how many points you want to plot in the x and y directions. Set up range variables i and j to index these points. For example, if you want to plot 10 points in each direction, enter:
i:= 0 .. 9 j :=0 .. 9
• Define Xi and Yj as evenly as evenly spaced points on the x- and y-axes.
• Fill the matrix M with the values ofj(xi, y).
• Show M in a contour plot.
Note that if you plot a function as described here, the positive x-axis of the plot extends to the right and the positive y-axis extends toward the top of the window. Since the contour plot is created by putting the heights above the.xy plane into a matrix, Mathcad has no way of knowing the actual values of the x and y axes. For this reason, the axes on contour plots are by default normalized to extend from 1 to -1 .You can manually change the axis limits from these default values by choosing GrapheeSl) Plot from the Format menu with the contour plot selected or by double-clicking on the plot. Then set the values you want in the Min. Val. and Max. Val. text boxes on the Axes page.