Invert a function
RGerkin
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
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