The SFIT function determines a polynomial fit to a surface and returns a fitted array. The function fitted is:
This routine is written in the IDL language. Its source code can be found in the file
sfit.pro
in the
lib
subdirectory of the IDL distribution.
Create a grid from zero to six radians in the X and Y directions:
X = (FINDGEN(61)/10) # REPLICATE(1,61)
Evaluate a function at each point:
Compute a sixth-degree polynomial fit to the function data:
Display the original function on the left and the fitted function on the right, using
WINDOW, XSIZE = 800, YSIZE = 400
!P.MULTI = [0, 2, 1] ; Set up side-by-side plots.
!P.BACKGROUND = 255 ; Set background color to white.
!P.COLOR = 0 ; Set plot color to black.