Previous Getting Started with IDL: Plotting Irregularly Gridded Data Next

Creating a Dataset

Create a set of 32 irregularly-gridded data points in 3-D space that we can use as arguments to the TRIGRID and TRIANGULATE functions.

  1. Open a window for viewing:
  2. WINDOW  
    

     

  3. Set SEED to the longword value 1. SEED is used to generate random points.
  4. SEED=1L  
    

     

  5. Set the number of points to be randomly generated.
  6. N=32  
    

     

  7. Create a set of X values for each of the 32 data points.
  8. X=RANDOMU(SEED,N)  
    

     

  9. Create a set of Y values for each of the 32 data points.
  10. Y=RANDOMU(SEED,N)  
    

     

  11. Create a set of Z values for each of the 32 data points from the X and Y values.
  12. Z=EXP(-3*((X-0.5)^2+(Y-0.5)^2))  
    

     

  13. Plot the XY positions of the random points.
  14. PLOT,X,Y,PSYM=1,TITLE='Random XY Points'  
    

     

    Figure 10-1: Plot of random values

    Figure 10-1: Plot of random values

     

  15. Dismiss the graphics window:
  16. WDELETE  
    

  IDL Online Help (March 06, 2007)