//      PROGRAM PGDEM7

// Demonstration program for 3D surface plotting routine FREDDY.

      A = floatarray(51,51)

      if (pgbeg(0, plotdevice, 1, 1) != 1) break

// Calculate a sample data array.

      for I=1,51 {
         for J=1,51 {
            R = (I-26)^2 + (J-26)^2
            R = 0.5*sqrt(R)
            if (R > 0.0) {
               A[I,J] = sin(R)/R
            } else {
               A[I,J] = 1.0
            }
         }
      }

// FREDDY assumes the window is square of size SIZE.

      SIZE = 1.0
      pgenv 0., SIZE, 0., SIZE, 1, -2
      freddy A,51,51, SIZE, 25.0
      pgend
