Invert a function

Makes an inversion of the wave (also interpolates, so number of data points will be different)
Function /wave Invert(w[,lo,hi,points])
    Wave w
    Variable lo,hi,points
#if exists("Interpolate2")
    WaveStats /Q w
    lo=ParamIsDefault(lo) ? V_min : lo
    hi=ParamIsDefault(hi) ? V_max : hi
    points=ParamIsDefault(points) ? 1000 : points
    String invert_name=CleanUpName(NameOfWave(w)+"_Inv",1)
    Make /o/n=(points) $invert_name /wave=Inverted=0
    SetScale /I x,lo,hi,Inverted
    Duplicate /free w Temp
    Temp=DimOffset(w,0)+p*DimDelta(w,0)
    Interpolate2 /T=1 /I=3 /Y=Inverted w,Temp
    return Inverted
#else
    printf "Need Interpolate XOP.\r"
#endif
End

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More