SURFACE_FIT Function
Standard Library function that determines the polynomial fit to a surface.
Usage
result = SURFACE_FIT(array, degree)
Input Parameters
array—The two-dimensional array of data to which the surface will be fit. The two dimensions do not have to be the same size. The number of data points must be ³ (degree + 1)2.
degree—The maximum degree of the fit (in one dimension).
Returned Value
result—A two-dimensional array of values as calculated from the least-squares fit of the data.
Keywords
None.
Discussion
SURFACE_FIT first determines the coefficients of the polynomials in both directions, using the least-squares method of the POLYWARP function. It then uses these coefficients to calculate the data points of the result array.
Example
OPENR, 1, !Data_dir + 'pikeselev.dat'
data = FLTARR(60, 40)
; Read in the data from the pikes elevation file.
READF, 1, data
; Close the input file.
CLOSE, 1
; Show the raw data without fitting.
SURFACE, data
; Approximate a linear least-squares fit.
SURFACE, SURFACE_FIT(data, 1)
; Do a second-degree polynomial fit.
SURFACE, SURFACE_FIT(data, 2)
; Do a third-degree polynomial fit.
SURFACE, SURFACE_FIT(data, 3)
; Do a forth-degree polynomial fit.
SURFACE, SURFACE_FIT(data, 4)
; Do a fifth-degree polynomial fit.
SURFACE, SURFACE_FIT(data, 5)