CHAPTER 2

Plotting Functions and Data in Maple


In this chapter we discuss some of the various ways of entering data in Maple and describe Maple V's new and greatly improved plotting capabilities. MATLAB is still the instructor's choice for giving engineering students a set of tools that are both simple to use and yet produce professional quality graphics. Maple has made great progress: Maple V gives the user most of the same tools, but there are limitations.

Topics covered in this chapter are:

2.1 Simple 2D Plots of one or more Functions
2.2 Entering Numerical Data for Plotting
2.3 Plots in 3D
2.4 Printing the Plot Windows

2.1 Simple 2D Plots of one or more Functions

As help for the plot command says, the basic form for creating a two dimensional plot is:
 


plot(f(x),x=a..b);

where the first argument gives one or more functions to be plotted and the second argument gives the range of the independent function. You can also give a third argument to restrict the vertical range as well the horizontal. More than one plot can be created at a time. Two examples are shown in session 2.1.

Note the use of brackets in the second plot to enclose the two functions.


2.2 Entering Numerical Data for Plotting

Numeric data in arrays may be plotted with the same plot command. Two different data structures are accepted, but neither is very convenient if you start with x data in one vector and y data in a second vector. The required form for the data is as:

a list of points : [[x1, y1], [x2, y2], ...[xn,yn]]
A program called yxplot makes it much easier to plot one vector against another one. It is modeled after the Matlab program of the same name and must be loaded before it can be used.

Session 2.2 shows examples of plotting the following lists of points.
i
x
y
1
0.0
0.1
2
1.4
4.2
3
3.5
6.6
4
4.5
8.2
5
6.1
7.1
6
8.0
4.1

For more information on arrays or plot, see the on-line help.


2.3 Plots in Three Dimensions

In 3D plotting, a 25 by 25 grid (generating 625 points) is the default. If a different number of points is desired, the plot3d option grid = [m,n] may be used. Here m and n must be positive integers. If more than one function is to be plotted, each function will be plotted at m by n points.

Unlike two-dimensional plots, three-dimensional plots allow more interaction after the plot has been displayed. Changes can be made to graph via the menu bar on Maple Vr5. The menu allows the user to change the color, the axes, the projection, and other things about the three-dimensional plot. The 3D plot can be rotated to the user's preference by simply clicking on the plot and holding the left mouse button down. The plot is replaced by an outline box as the plot is rotated. In order to redraw the plot at the chosen viewpoint, simply double-click on the plot. Session 2.3 gives an example of a 3D plot.

For more information on using plot3d type, see the on-line help. With all its plotting versatility, there are still some tasks which Maple does not at present seem to be able to accomplish. For example, it is unable to plot functions with overlapping but non-identical ranges in x.


2.4 Printing the Plot Windows

It is probably easiest in a Unix system to create a postscript file of your plots and then print them on your usual laser printer.


Return to Table of Contents