Navigation:  How do I ...? > Algebra >

How do I graph an equation?

Print this Topic Previous pageReturn to chapter overviewNext page

Three different Generate menu commands allow you to generate a graph of an equation. Which command you should use is dependent on the form of your equation.

Y=f(X) produces X,Y pairs from an equation you specify between given lower and upper limits.

Since the function will only produce one unique Y value for every X, it is not possible to plot, for example, a circle or an ellipse using this command. For circles, ellipses, etc., use:

X=f(T), Y=g(T) generates X,Y pairs from parametrical equations in which X and Y are both functions of a third independent parameter T.

This command is particularly useful for producing graphs of equations that cannot be handled properly by Y=f(X). For example, although Y=sqrt(R^2-X^2) is the correct equation for a circle, use of this equation with Y=f(X) will only result in a semicircle (the positive Y half). But you can easily produce a circle with X=f(T), Y=g(T) by applying a bit of trigonometry. With T varying from 0 to 360 degrees, X=R*cos(T), Y=R*sin(T) defines a circle of radius R (substitute the actual radius for "R") centered at the origin. For a circle centered at (H,K), you'd use X=H+R*cos(T) and Y=K+R*sin(T).

The X=f(T), Y=g(T) command is of course useful for other geometric shapes that have more than one Y value for each X. To plot an ellipse X^2/A^2 + Y^2/B^2 = 1, for example, use X=A*cos(T), Y=B*sin(T) with, again, T varying from 0 to 360 degrees.

You might also find this command useful for generating unevenly-spaced data points. For example if you want your points to be evenly spaced on a logarithmic scale, you can use X=10^(T), Y=some function of (10^(T)).

Z=f(X,Y) produces (initially) a 2D contour plot of Z values, where Z is a function of X and Y. Since you can only have one surface per plot, this command will automatically open a new document window if the currently active window already contains a plot.

You can subsequently change the format to a 3D surface plot with the Contour Options command on the Options menu.

Scaling
For XY plots, DPlot initially uses as much of the display as possible for your graph. For this reason, the physical distance between equal values on the X and Y axes will generally not be the same. In other words, a circle produced with X=f(T), Y=g(T) will seldom be circular initially. You can force a 1:1 scaling by using the Extents/Intervals/Size command on the Options menu. Check both the Specify extents and Specify plot size boxes. Enter the desired extents on both the X and Y axes under Specify extents, then use proportional values for the plot width and height under Specify plot size. For example, if the X axis extends from 2 to 8 (10 units) and the Y axis extends from 4 to 8 (4 units), then the plot width should be 10/4 = 2.5 times the plot height. Conversely, if you want the plot width and height to be specific values (square, for example), then change the plot extents so that they are proportional to the width and height.

For 3D data, DPlot initially uses a scale factor of 1 for each of the X, Y, and Z axes. This means that 1 unit on the X axis will have the same physical length as 1 unit on the Y and Z axes. Depending on the extents and type of the input data this may not be appropriate. There are a couple of alternatives to this default behavior. If you check Always auto-adjust scale factors on 3D plots on the Options>General dialog, then DPlot will set initial scale factors such that the plot is square in the XY plane and the Z extents appear to be about 1/2 that of X and Y. This is a useful feature if you frequently plot data sets with values in different units. You can also manually enter scale factors for each of the X, Y, and Z axes using the Contour Options command on the Options menu.

 


Page url: https://www.dplot.com/help/index.htm?how_equation.htm