Fitting part of a wave in Igor Pro
Most fits are over a window, and there are two ways to say which one.
Function FitTail(WAVE y)
Variable first = 200, last = numpnts(y) - 1
Make/O/N=(numpnts(y))/D weights = 1
weights[0, first - 1] = 0
CurveFit/Q/M=0 exp_XOffset, y[first, last] /W=weights /I=1 /D
WAVE W_coef
Printf "decay constant %.4g\r", W_coef[2]
return W_coef[2]
End
How it works
/R=[first, last]limits the fit to a range of points.- A mask wave with
/M=excludes points one by one. /W=weights the points, which is how error bars enter a fit.
Keywords and builtins used here
CurveFitEndFunctionMakePrintfVariableWAVEnumpntsreturn
The run, in numbers
- Lines
- 12
- Characters to type
- 270
- Tokens
- 78
- Three-star pace
- 85 tpm
At the three-star pace of 85 tokens a minute, this run takes about 55 seconds.
Step 2 of 3 in Curve fitting, step 9 of 16 in Waves & analysis.