navigation map

Chapters:
  1: Introduction
  2: Simple example
  3: Invocation
  4: Finer Control
  5: X-Y Plots
  6: Contour Plots
  7: Image Plots
  8: Examples
  9: Gri Commands
  10: Programming
  11: Environment
  12: Emacs Mode
  13: History
  14: Installation
  15: Gri Bugs
  16: Test Suite
  17: Gri in Press
  18: Acknowledgments
  19: License

Indices:
  Concepts
  Commands
  Variables
index.html#Top ListOfGriCommands.html#ListOfGriCommands Gri: `sleep' command Gri: `source' command index.html#Top Gri: `source' command

9.3.45: `smooth'

All these smoothing commands ignore the location of the data. For equispaced data these algorithms have the standard interpretation in terms of digital filters. For non-equispaced data, the interpretation is up to the user.


`smooth {x [.n.]} \
  | {y [.n.]} \
  | {grid data [.f.|{along x|y}]}'

The `smooth x' command does smoothing by the following formula


x[i-1]   x[i]   x[i+1]
------ + ---- + ------
  4       2       4

The `smooth x .n.' command does boxcar smoothing with centred boxcars `.n.' points wide. The `smooth y' command does the same as `smooth x', but on the `y' column.

There are several methods of smoothing grid data. Note that isolated missing values are filled in by each method. (Let the author know if you'd like that `feature' to be an option.)

The `smooth grid data' command smooths gridded data, by weighted average in a plus-shaped window about each gridpoint. The smoothing algorithm replaces each interior gridpoint value `z[i][j]' by


z[i][j]   z[i-1][j] + z[i+1][j] + z[i][j-1] + z[i][j+1]
------- + ---------------------------------------------
   2                          8

Points along the edges are smoothed by the same formula, after inventing image points outside the domain by planar extrapolation.

The `smooth grid data .f.' command performs partial smoothing. A temporary fully-smoothed grid `zSMOOTH[i][h]' is constructed as above, and a linear combination of this grid and the original grid is used as the replacement grid:


z[i][j] = (1-f) * z[i][j] + f * zSMOOTH[i][j]

where `f' is the value indicated on the command line. Thus, `smooth grid data 0' performs no smoothing at all, while `smooth grid data 1' is equivalent to `smooth grid data'.

The `smooth grid data along x' command smooths the grid data across `x' (i.e., horizontally), by replacing each value `z[i][j]' with the value


z[i][j]   z[i-1][j] + z[i+1][j]
------- + ---------------------
   2                4

Points along the edges are smoothed by the same formula, after inventing image points outside the domain by linear extrapolation.

The `smooth grid data along y' command does the same thing as `smooth grid data along x', but the smoothing is along `y'.

See also see Filter, a generalization of `smooth x|y' which allows for more sophisticated filters.

navigation map