Use contour plots to visualize a function of two variables or 3D data. The data can be stored in a matrix or in a vector of three matrices as returned by the
CreateMesh function.
Input Data for Contour Plots
The contour function supports three input data formats:
• A function of two variables
• A vector-valued function of two parameters with three elements defining the x-, y-, and z- coordinates
• A m*n matrix, where the cell’s indices represent the x- and y- coordinates and the cell values represent the z coordinates
• A vector of three nested matrices, representing the x-, y-, and z- coordinates, as given by the output of the
CreateMesh function
• Contour plots can only plot surfaces that are defined at each point of the given surface. If the definition of one point is missing, the contour plot returns an error.
• You cannot plot free x, y, z data in a contour plot. For this purpose, use a 3D plot. In 3D plots, when you use free x, y, z data, PTC Mathcad cannot create a surface and displays the points in 3D space.
Controlling the Axis Ranges
The default x-, y-, and z-axis range of a newly inserted contour plot is -10 to +10. If you type a function, a matrix, or a vector of three nested matrices inside the axis expression placeholder, then the x-, y-, and z-axis ranges change automatically to accommodate the plotting of all data points.
You can manually change the range of any axis by editing one or more of its three tick mark values:
• Lower limit tick mark
• Interval tick mark
• Upper limit tick mark
You can specify contour values by directly editing the tick marks on the color scale (z-axis).
Unlike XY plots, to restore the default values of the z-axis, you must delete the value of all three tick marks.
Handling Singularities
A contour plot might be able to handle a singularity data point if it falls in the middle of the data set. The plot fails if the singularity matches, or is very close to, the lower or upper limits of the x- or y-axis.
In case of a singularity problem, try one of the following workarounds:
• Increase the lower tick mark value by a small amount.
• Use the
if function to remove the singularity from the function.