Generating a common x axis from interpolation2 command
mudiyans
Hello, I am fairly new for Igor and I need help with interpolation2 command. I am plotting Cyclic voltammetry data in Igor. These curves have different x axises after iR corrections. Therefore I want to generate a common x axis. I want to know how to exactly use the interpolation2 command for this.
Thank you in advance
Use /I=3 (X values taken from destination wave) and /X=<wave> where <wave> is some wave that you create that has the desired X values.
May 4, 2023 at 09:38 am - Permalink
If you want the output to be waveforms as opposed to XY pairs, you can use /Y=yDest, omit /X=xDest, and specify /I=3 (X from Dest). This creates a waveform output where the X values are determined by the X scaling that you set before calling Interpolate2.
I am attaching an experiment file that illustrates this. See the Demo function in the procedure window.
If you are not familiar with the distinction between XY pairs and waveforms, execute this:
DisplayHelpTopic "The Waveform Model of Data"
and continue to read the following section, "The XY Model of Data".
Here is a copy of the Demo function in the attached experiment file:
// Create input XY data
Make/O/N=10 xData0 = p + gnoise(.1), yData0 = sin(x)
Make/O/N=10 xData1 = p + gnoise(.1), yData1 = sin(x) + .25
// Display input XY data in table
if (WinType("DemoTable") == 0)
Edit/N=DemoTable xData0, yData0
AppendToTable/W=DemoTable xData1, yData1
endif
// Display input data in graph
if (WinType("DemoGraph") == 0)
Display/N=DemoGraph/W=(19,45,917,624) yData0 vs xData0
AppendToGraph/W=DemoGraph yData1 vs xData1
ModifyGraph mode(yData0)=3,marker(yData0)=19
ModifyGraph mode(yData1)=3,marker(yData1)=19
ModifyGraph rgb(yData1)=(1,16019,65535)
endif
// Make destination waves and set their X scaling
Make/O/N=50 dest0, dest1
SetScale x, 0, 9, "", dest0, dest1
AppendToTable/W=DemoTable dest0.id, dest1.id
// Do interpolation using waveform output with X From Dest
Interpolate2/T=1/Y=dest0/I=3 xData0,yData0
Interpolate2/T=1/Y=dest1/I=3 xData1,yData1
// Append output to graph
CheckDisplayed/W=DemoGraph dest0
if (V_Flag == 0)
AppendToGraph/W=DemoGraph dest0
ModifyGraph/W=DemoGraph mode(dest0)=4,marker(dest0)=10
endif
CheckDisplayed/W=DemoGraph dest1
if (V_Flag == 0)
AppendToGraph/W=DemoGraph dest1
ModifyGraph/W=DemoGraph rgb(dest1)=(1,16019,65535)
ModifyGraph/W=DemoGraph mode(dest1)=4,marker(dest1)=10
endif
End
May 4, 2023 at 04:30 pm - Permalink
Thank you very much for the really helpful comments. I was able to resolve my issue with these. Thank you very much once again.
July 12, 2023 at 01:00 pm - Permalink