﻿ Problem Descriptor Reference > The Elements of a Descriptor > Built-in Functions > The FIT Function

# The FIT Function   The following two forms may be used to compute a finite-element interpolation of an arbitrary argument:

result = FIT(expression)

computes a Finite Element fit of the given expression using the current computational mesh and basis.  Nodal values are computed to return the correct integral over each mesh cell.

result = FIT(expression, weight)

as with FIT(expression), but with a smoothing diffusion with coefficient equal to weight (try 0.1 or 1.0, and modify to suit).

weight may be an arbitrary expression, involving spatial coordinates, time, or variables of the computation.  In this way it can be used to selectively smooth portions of the mesh.  The value of weight has a well-defined meaning: it is the spatial wavelength over which variations are damped:  spatial variations with wavelength much smaller than weight will be smoothed, while spatial variations with wavelength much greater than weight will be relatively unmodified.

Note: FIT() builds a continuous representation of the data across the entire domain, and connot preserve discontinuities in the fitted data.  In some cases, multiplying the data by an appropriate material parameter can result in a continuous function appropriate for fitting.   An exception to this rule is in the case of CONTACT boundaries, where the mesh nodes are duplicated, and discontinuities can be preserved in FIT functions.

FIT() may be used to smooth noisy data, to block ill-behaved functions from differentiation in the derivative computation for Newton's method, or to avoid expensive re-computation of complex functions.

See also the SAVE function, in which nodal values are directly computed.

Example:

Samples | Usage | fit+weight.pde