Resampling in Igor Pro
Two waves rarely share an x axis, and Interpolate2 is how they come to.
Function/WAVE OntoGrid(WAVE yIn, WAVE xIn, Variable count)
Make/O/N=(count)/D gridded
SetScale/I x, xIn[0], xIn[numpnts(xIn) - 1], gridded
Interpolate2/T=2/N=(count)/I=3/Y=gridded xIn, yIn
Duplicate/O gridded, halved
Resample/DOWN=2 halved
return gridded
End
How it works
/T=2asks for a cubic spline; 1 is linear./N=sets how many points the output has;/I=3writes a y wave.Resamplechanges the rate of an evenly-spaced wave instead.
Keywords and builtins used here
DuplicateEndFunctionInterpolate2MakeResampleSetScaleVariableWAVEnumpntsreturn
The run, in numbers
- Lines
- 11
- Characters to type
- 261
- Tokens
- 73
- Three-star pace
- 85 tpm
At the three-star pace of 85 tokens a minute, this run takes about 52 seconds.
Step 3 of 4 in Signals & matrices, step 13 of 16 in Waves & analysis.