top banner
Gri Commands
1: Introduction
2: Simple example
3: Fancy example
4: Running Gri
5: Programming Gri
6: General Issues
7: X-Y Plots
8: Contour Plots
9: Image Plots
10: Examples
11: Handling Data
12: Gri Commands
13: Gri Extras
14: Evolution of Gri
15: Installing Gri
16: Gri Bugs
17: System Tools
18: Acknowledgments
19: License
20: Newsgroup

21: Concept Index
navigate navigate navigate navigate navigate navigate

12.44: The `smooth' Command

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 using 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.
bottom banner