typestar

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

  1. /T=2 asks for a cubic spline; 1 is linear.
  2. /N= sets how many points the output has; /I=3 writes a y wave.
  3. Resample changes the rate of an evenly-spaced wave instead.

Keywords and builtins used here

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.

Type this snippet

Step 3 of 4 in Signals & matrices, step 13 of 16 in Waves & analysis.

← Previous Next →