Using Units in Plots
Go to Maple Portal Maple Portal for Engineers
|
Introduction
|
|
Maple allows you to create both 2-D and 3-D plots with units. The units can be supplied in the function, ranges, or as an option. The axis labels will display the unit information deduced from the arguments.
|
|
Units in 2-D Plots
|
|
You can add units from the Units palettes to an expression that is graphed with the plot command.
Example: In this example, units are added to the -range and the expression.
You can create a plot with units interactively by using the context-sensitive menu.
Example: Right-click (Control-click, for Macintosh) on the expression, and from the context menu select Plot>2-D Plot.
You can also add units with the 'useunits' option. With this option, the units are given in a list useunits=[units for , units for ].
Example: Since minutes are not one of the units present in the Units palette, use the palette item and then replace the placeholder with min.
Instead of using the palette, you can add units with the Unit command as follows: .
To use units in a plot command written in 1-D math, use this method.
>
|
plot(-x^3+5*x^2,x=0..5,useunits=[Unit(kg),Unit(m)],color="Chocolate");
|
|
|
Plotting Expressions versus Procedures with Units
|
|
You can create a graph with units from an expression or a procedure. See the help page plot/details for more information.
When you plot an expression, the axes labeling shows the variable names and units. This is shown in the following example (as well as all the earlier examples).
Example:
When you plot a procedure, such as the function defined here, no variable names are used.
Example:
Note: To plot a procedure that contains units, you must tell the plotting command that units are involved so that the procedure is properly processed. For computational efficiency, when a procedure is plotted, the values returned from the procedure are assumed to be unit-free by default. Therefore, if your procedure returns a numeric value with units, you must specify to the plotting command that units are involved. You can specify this by including units in the ranges or by using setting the option useunits=true (or simply useunits). See the help page Plots with Units for details.
Example: Specify that units are involved in the procedure by using units in the ranges.
Alternatively, indicate that the procedure returns units by using the useunits option. The first example simply indicates that the procedure involves units, while the second example specifies units to be displayed on the axes.
To make further modifications to any plot, you can use options to the plot command or make modifications interactively by clicking on the plot and using the Plot menu.
|
|
Units in 3-D Plots
|
|
The plot3d command recognizes units similarly to the plot command. By default, axes are not displayed for a 3-D plot. Thus, you will have to display the axes to see the unit information. The option axes can be boxed, normal, frame, or none.
Example:
Alternatively, graph the plot and then select Axes>Boxed from the Plot menu.
|
Go to Maple Portal Maple Portal for Engineers
|