FuncFitMD
FuncFitMD [ flags ] fitFuncName, cwaveName, waveName [ flag parameters ]
The FuncFitMD operation performs a curve fit to the multivariate user defined function specified by fitFuncName. FuncFitMD handles gridded datasets in multidimensional waves. Most parameters and flags are the same as for the CurveFit and FuncFit operations; differences are noted below.
FuncFitMD operation parameters are grouped in the following categories: flags, parameters (fitFuncName, cwaveName, waveName), and flag parameters. The sections below correspond to these categories. Note that flags must precede the fitFuncName and flag parameters must follow waveName.
Flags
| /L=dimSize | Sets the dimension size of the wave created by the auto-trace feature, that is, /D without destination wave. The wave fit_waveName will be a multidimensional wave of the same dimensionality as waveName that has dimSize elements in each dimension. That is, if you are fitting to a matrix wave, fit_waveName will be a square matrix that has dimensions dimSize x dimSize. caution dimSize =100 requires 100 million points for a 4-dimensional wave! | |
Parameters
| fitFuncName | User-defined function to fit to, which must be a function taking 2 to 4 independent variables. | |
| cwaveName | 1D wave containing the fitting coefficients. | |
| waveName | The wave containing the dependent variable data to be fit to the specified function. For functions of just one independent variable, the dependent variable data is often referred to as "Y data". You can fit to a subrange of the wave by supplying (startX,endX) or [startP,endP] for each dimension after the wave name. See Wave Subrange Details below for more information on subranges of waves in curve fitting. | |
Flag Parameters
These flag parameters must follow waveName.
| /T=twaveName | Like /X except for the T independent variable. This is a 1D wave having as many elements as waveName has chunks. | |
| /X=xwaveName | X independent variable values for the data to fit come from xwaveName instead of from the X scaling of waveName. This is a 1D wave having as many elements as waveName has rows. | |
| /Y=ywaveName | Like /X except for the Y independent variable. This is a 1D wave having as many elements as waveName has columns. | |
| /Z=ywaveName | Like /X except for the Z independent variable. This is a 1D wave having as many elements as waveName has layers. | |
| /NWOK | Allowed in user-defined functions only. When present, certain waves may be set to null wave references. Passing a null wave reference to FuncFitMD is normally treated as an error. By using /NWOK, you are telling FuncFitMD that a null wave reference is not an error but rather signifies that the corresponding flag should be ignored. This makes it easier to write function code that calls FuncFitMD with optional waves. | |
| The waves affected are the X wave or waves (/X), the Y spacing wave (/Y), the Z spacking wave (/Z) the T spacing wave (/T), weight wave (/W), epsilon wave (/E) and mask wave (/M). The destination wave (/D=wave) and residual wave (/R=wave) are also affected, but the situation is more complicated because of the dual use of /D and /R to mean "do autodestination" and "do autoresidual". See /AR and /AD. | ||
| If you don't need the choice, it is better not to include this flag, as it disables useful error messages when a mistake or run-time situation causes a wave to be missing unexpectedly. | ||
note To work properly this flag must be the last one in the command. | ||
Details
Auto-residual (/R with no wave specified) and auto-trace (/D with no wave specified) for functions having two independent variables are plotted in a separate graph window if waveName is plotted as a contour or image in the top graph. An attempt is made to plot the model values and residuals in the same way as the input data.
By default the auto-trace and auto-residual waves are 50x50 or 25x25x25 or 15x15x15x15. Use /L=dimSize for other sizes. Make your own wave and use /D=waveName or /R=waveName if you want a wave that isn't square. In this case, the wave dimensions must be the same as the dependent data wave.
Confidence bands are not available for multivariate fits.
Wave Subrange Details
Almost any wave you specify to FuncFitMD can be a subrange of a wave. The syntax for wave subranges is the same as for the Display command; see Subrange Display Syntax for details. Note that the dependent variable data (waveName) must be a multidimensional wave; this requires an extension of the subrange syntax to allow a multidimensional subrange. See CurveFit Wave Subrange Details section for a discussion of the use of subranges in curve fitting.
The backwards compatibility rules for CurveFit apply to FuncFitMD as well.
A subrange could be used to pick a plane from a 3D wave for fitting using a fit function taking two independent variables:
Make/N=(100,100,3) DepData
FuncFitMD fitfunc2D, myCoefs, DepData[][][0] ...
See Also
CurveFit for parameter details. See Fitting to a Multivariate Function for the proper form for the functionName as well as the use of cwaveName and ewaveName.