IM

Organizing Data | Using Spyglass

Making 3D Graphs

Data organization and Computer Operations

Data Characteristics | Generating Data | Finding Data

Data Characteristics:
What kind of data is needed to generate a 3D graph?

You must have three independent variables and a dependent variable.

Two other important characteristics of your data are:
  • The three independent variable values must all be integers.
  • The independent variables cannot be repeated. (i.e., you can't have f(1,2,3)=7 and f(1,2,3)=9)
  • Note: If your independent variables are floating points then scale them to integers so they can be used as indices in the arrays as previously described. Click for information on how to scale data, and a sample program.

    Since the independent variables are stored in as elements in the array, they must be integers. For example, if under the three independent variables 3, 4, and 5 the resulting dependent variable is 10, it would be stored in the array element a[3][4][5]. When assigning an array it is impossible to give the elements decimal values, which makes it necessary for all non-integers values to be scaled into integers.

    The dependent variable data's format depends on the program you use. If you use Spyglass Dicer your dependent variable values must be integers between 0 and 255, because color values in Spyglass Dicer are integers from 0 to 255. Consequently, the each data point corresponds to a color in Spyglass Dicer. If you use PV-Wave the dependent varible can be in any format. For other programs consult the program manuals or a knowledgeable person.

    How big will your cube be?

    You need to find the range of each of your independent variables, and how many independent variables you will have one each side of the cube. With small data sets, you can find the independent variable range my hand, but with larger data sets you may want to use a program to find the minimum and maximum values of your data. The next section has a program that may help you,skip there. Once you find the min and max of your data, multiply the difference between the minimum and maximum of the three independent variables to get the cube's volume. In Spyglass Dicer you can increase or decrease the size of the cube so that it is a good size for investigation.

    Watch out for holes in your data.

    A hole in your data means that you don't have a value for a section of data points within the range of an independent variable. It is not necessary for your data to fill the cube completely, but your don't want your data to look like Swiss cheese either. If you have a very large data set, it may be hard to tell if your holes will make the 3D graph useless before it's plotted. Just plot the data, and if there are too many holes, think of it as good practice.

    What does an ASCII file look like?

    An ASCII file is just your dependent variable data organized in a grid format.

    Generate Your Data

    Generating your own data has benefits.
  • No holes.
  • Can change amount of data easily.
  • Draw backs:
  • The data has to be from a function
  • The data can be hard to find an interesting function.
  • Generating 3D data from a function is good practice. If you choose a simple function (that you know what it should look like), using generated can be a way to test your method of scaling data and changing formats to fit program specifications.

    The C program that generates data from (0,0,0) to (X_MAX, Y_MAX, Z_MAX) of the function, f(x,y,z) = (-4x)/(x^2+y^2+1) + z^2.

    You can use this program and change the C code in the funt_one() function to fit your own function. You may want to change the name of the output file(currently funct_two.ascii), and the array size. The output of this C program is floating points, so you will need to scale the data. (Unless your function does not require floating point accuracy.)

    The easiest way to scale your data is to use Spyglass Data Utility, with your ascii file. Follow Spyglass Data Ulitlity link for directions on how to do this.

    The following instructions are the hard way:

    You need to use the two following programs:

    The UNIX commands to run your file though these two programs are:

    prompt% atof yourfile.bin
    prompt% yourfile.bin | minmax
    min=4.00 max=90.00 sub=4.000 div=0.5598 (this output was made up for example purposes)
    prompt% scalebin 4.000 0.5598 your_new_scaled_file.ascii

    Ideas on where to find raw data

    1. Make up a survey or test for classmates or friends that has three independent variables and one dependent variable. Here is an example: you could test subjects ability to take short math quizzes of varying difficulty with different music playing. Your three independent variables would be: difficulty of the math test, music, and subjects. The dependent variable would be the time it took to complete the test (or test score). You would need five short math quizzes varying in difficulty, and three sets of the quizzes so that you can quiz your subjects three different times with different music playing (i.e, no music (silence), Mozart, and pop/rock). Making up a little experiment like this is more work than generating data from a computer program but it can rewarding.

    2. Send letters to researchers or administration at your institution and ask if anyone has multi-variable data that they would like generated into a 3D graph.

    3. Search the Web. Here are some possible web sites.

    American Statistical Association: http://www.amstat.org/

    Cambridge University: http://www.statslab.cam.ac.uk/~vincent/stat/index.html




    Last revised July 19, 1996
    http://www.sv.vt.edu/class/surp/surp96/laughlin/stat/3D_tutor/computer_operations.html