1. Open a window for viewing:
window
2. Set seed to the longword value 1. seed is used to generate random points.
seed=1l
3. Set the number of points to be randomly generated.
n=32
4. Create a set of x values for each of the 32 data points.
x=randomu(seed,n)
5. Create a set of y values for each of the 32 data points.
y=randomu(seed,n)
6. Create a set of z values for each of the 32 data points from the x and y values.
z=exp(-3*((x-0.5)^2+(y-0.5)^2))
7. Plot the XY positions of the random points.
plot,x,y,psym=1,title='Random XY Points'

8. Dismiss the graphics window:
wdelete
1. Open a window for viewing:
window
2. To return a triangulation in the variable tr, enter the command:
The variable TR now contains a three-element by 54-element longword array (you may see this by typing Help, TR at the IDL Command Line).triangulate,x,y,tr
Note: This is not always a 54-element array, it may vary based on the number of points.
3. To produce a plot of the triangulation, shown below, enter the following commands:
plot,x,y,psym=1,title='Triangulation'
for i=0,n_elements(tr)/3 - 1 $
do begin & t=[tr[*, i],tr[0, i]] & plots,x[t],y[t] & endfor

4. Dismiss the graphics window
wdelete
1. Display a surface plot of the gridded data by passing the result of the TRIGRID function to SURFACE, using the default interpolation technique and add a title to the plot, shown below, by entering:
surface,trigrid(x,y,z,tr)
xyouts,.5,.9,'Linear Interpolation',align=.5,/normal

The TRIGRID function can also return a smoothed interpolation. Set the QUINTIC keyword to use a quintic polynomial method when interpolating the grid.
2. Display the results of the quintic gridding method, shown below, by entering:
surface,trigrid(x,y,z,tr,/quintic)
xyouts, .5,.9,'Quintic Interpolation',align=.5,/normal

| This information is available in alternative formats upon request by individuals with disabilities. Please send email to alt-format@msi.umn.edu or call 612-624-0528. | ||||||||||||
|
HOME |
QUESTIONS |
FEEDBACK
|
||||||||||||
|
||||||||||||