# May 2009 Archives

## Area enclosed by a polygon

From support e-mail:

Q: Will DPLOT compute the area and or acreage within a closed plotted polygon?

A: Yes. If you use the \$AREA shortcut in any text entry (title lines, axis labels, legend, etc.) DPlot will report the area enclosed by your polygon. If the points are arranged in a clockwise direction the value will be positive; if counterclockwise the value will be negative. You can force a positive answer by using the absolute value operation, as in "Area=\$=(ABS(\$AREA))". The initial "\$=" tells DPlot an equation follows, which must be enclosed by parentheses.

If you have more than 1 curve then you'll need to use \$AREA(n), where n is the 1-based index of the curve.

For most applications (and in particular since you asked about acreage) the value replacing \$AREA is perfect. If you're trying to find the area enclosed by what should be a smooth curve, though, you might need to generate more points, if possible. The circle below was generated with X=f(t), Y=g(t) with X=2*cos(t), Y=2*sin(t) with the spacing in t set to 1 degree. The difference between the calculated area and the well-known area of a circle is due to the spacing between points.

In case anybody is wondering, the plain text for that text note is:

```R	=2
Area	=\$AREA
{\sp}r{\u2}	=\$=(PI*4)```

with the tab stop set to 5 characters.

For more information see How do I find the area under a curve? in the online manual.

## Area between 2 curves

From support e-mail:

Q: 1. Can DPlot find the area between two curves? Area under a curve?

A:No and yes, mostly. You can embed the area under a curve in any text entry (title line, axis label, legend, etc.) with \$AREA(n), where n is the index of the curve.

Since you can embed equations in those same entries and also embed text shortcuts like \$AREA in equations, you can indirectly report the area between two curves with something like "\$=(\$AREA(1)-\$AREA(2))". This will work fine as long as the curves don't cross. If they DO cross then you can get the area with a bit of manipulation: Use Generate>Y=f(X,Y1,Y2,...) with Y=abs(Y1-Y2) (to find the area between curves 1 and 2), then \$AREA() on that new curve to find your answer.

Q: 2. Why is DPlot so much cheaper than other programs such as UniPlot or SigmaPlot?

A: Good question :-). Both of those programs will do a few things DPlot will not. Whether that difference is worth 10+ times the price is something users will have to answer for themselves.

## Finding average Z value in a surface plot

From support e-mail:

Q: DPLOT has been very helpful to me in producing Isolux curves from Excel data.

The question is can I use DPLOT to compute the average lux within an area, or to integrate an area to directly compute the total lumen energy applied there?

Example:

A: DPlot has a couple of features that report the average magnitude for a surface plot (though neither of these is likely what you want). First, in the status bar DPlot shows the minimum, maximum, and average Z values for the displayed surface. (In other words if you zoom in or set the extents to different values, you'll likely see different values here.)

The second method is to use the \$MEAN shortcut in any text entry. Here we're using that shortcut in the 3rd title line:

After clicking OK and turning on "Borders" and "Data points", you'll get this:

Note the difference in average value displayed here and in the status bar (1.983469 vs. 3.458373). The difference is due to your original plot having the extents set to 0-50 in both X and Y, while the data goes out to X & Y = 87 or so (and the points at X or Y > 50 are all small magnitudes, which drives the \$MEAN value down.)

"Borders" and "Draw points" have been turned on to illustrate the bigger problem with both of these "average" reports: The average (or \$MEAN) is simply an average of all values with no consideration given to the spacing between points. Just guessing, but that's probably not what you want since every point has an equal weight in determining the "average" as every other point, regardless of the area affected. What you need is a rectangular grid with evenly-spaced points in the X and Y directions. Select Options>Generate Mesh to produce a grid with evenly-spaced points:

There's no magic involved in setting the number of intervals; any value that produces new points at a higher frequency than your original data will give a more realistic answer than your original plot. The "Bivariate" interpolation scheme generally results in a smoother surface than "Planar", but unless you have a good insight into your data there is usually no justification for using anything more complex than "Planar". The resulting plot, with the options shown above:

The \$MEAN value shown here (which will now match the status bar value unless/until you zoom) is a much better guess at an "average" Z.

For your second question: "... or to integrate an area to directly compute the total lumen energy applied there?": Sure. Use Generate>Find Volume Under Surface to... well... find the volume under the surface. This is numerically equivalent to integrating the surface.

If you divide the volume given by that dialog (4272.45) by the total area (2500) you get an "average" Z value of 1.70898, slightly different than the \$MEAN value of 1.733036. The difference is due to the \$MEAN calculation giving equal weight to all data points, including those along the edges of the surface. Which value is more useful for your particular application? I have no idea :-). Different applications will have different answers.