Plots > 3D Plots > Example: Plotting a Vector-Valued Function
  
Example: Plotting a Vector-Valued Function
Create a 3D mesh plot by defining a vector-valued function and compare the result with a plot that uses the CreateMesh function.
Plotting a Vector-Valued Function
Plot a vector-valued function to define a parametric surface in 3D space.
1. Define a vector-valued function of two parameters.
Click to copy this expression
In this function, u+v represents the x-coordinates, v2 represents the y-coordinates, and u*v represents the z-coordinates.
2. Press Ctrl+3, type the name of the function in the placeholder of the z-axis expression, and change the Trace Color and the Surface Fill.
Click to copy this expression
PTC Mathcad plots a vector-valued function as a mesh.
Plotting a Function Using CreateMesh
1. Define the range of the two above parameters so that they contain only positive values.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
2. Use CreateMesh to get a data set from the function g and the u and v ranges.
Click to copy this expression
Click to copy this expression
3. Press Ctrl+3 and plot M.
Click to copy this expression
The range of the M plot differs from the range of the g plot due to the difference in the input variables. M is plotted according to the ranges defined in step 1, while g is plotted according to the default range (-10, 10).
4. To set the range of g, define a range variable for u and v above the plot.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
5. Plot g again.
Click to copy this expression
When you plot a vector-valued function, you must define range variables above the plot to set the range.
Comparing the Two Plots
1. Define new values for the min and max of the ranges.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
2. Define the number of intervals and recalculate M.
Click to copy this expression
Click to copy this expression
Click to copy this expression
3. Recalculate the ranges of u and v.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
4. Plot M and g.
Click to copy this expressionClick to copy this expression
The two plots look exactly the same because identical nodes are plotted in both cases.