Here are the columns to generate what you are asking for. I took your interpolation formula as is, and implemented it. You may need to changes some things up.
Names default to Here(1);
// Create the sample data table
dt=New Table( "Example",
Add Rows( 24 ),
New Column( "ID",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[0.000002, 0.0000002, 0.00000002, 0.000000002, 0.0000000002,
0.000000000002, 0.000003, 0.0000003, 0.00000003, 0.000000003,
0.0000000003, 0.000000000003, 0.000004, 0.0000004, 0.00000004,
0.000000004, 0.0000000004, 0.000000000004, 0.000005, 0.0000005,
0.00000005, 0.000000005, 0.0000000005, 0.000000000005]
)
),
New Column( "VG",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[3, 2.8, 2.6, 2.4, 2.2, 2, 3, 2.8, 2.6, 2.4, 2.2, 2, 3, 2.8, 2.6, 2.4,
2.2, 2, 3, 2.8, 2.6, 2.4, 2.2, 2]
)
),
New Column( "Mod",
Character( 16 ),
"Nominal",
Set Values(
{"1A", "1A", "1A", "1A", "1A", "1A", "1B", "1B", "1B", "1B", "1B", "1B",
"1A", "1A", "1A", "1A", "1A", "1A", "1B", "1B", "1B", "1B", "1B", "1B"}
)
),
New Column( "Device",
Character( 16 ),
"Nominal",
Set Values(
{"X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1", "X1",
"Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1", "Y1"}
)
)
);
// Find the index
dt << New Column("Row", formula(
theMin = Col Minimum( Abs( 0.000001 - :ID ), :Mod, :Device );
theValue = .;
If( Abs( 0.000001 - :ID[Row()] ) == theMin,
show(.000001 - :ID[Row()]);
theValue = Row()
);));
dt<<New Column("Interpolation Row", formula(
theRow = Col Max( :Row, :Mod, :Device );
iRow = .;
If( Row() == theRow,
If( .000001 - :ID[theRow] > 0,
iRow = theRow - 1,
.000001 - :ID[theRow] < 0,
iRow = theRow +1,
iRow = theRow
);
);
));
iRow;
// Set the Vth
dt<<New Column("Vth", formula(
theRow = :VG[Col Max( :Row, :Mod, :Device )]));
dt<<New Column("Exact Vth", formula(
theRow = Col Max( :Row, :Mod, :Device );
a=matrix(:VG[:Row[theRow]]) || matrix(:VG[:Interpolation Row[theRow]]);
b=matrix(log10(:ID[:Row[theRow]])) || matrix(log10(:ID[:Interpolation Row[theRow]]));
theValue=interpolate(.0000001, a, b);
theValue;
));
// Clean up
dt:Vth << delete formula;
dt:Exact Vth << delete formula;
//dt<< delete columns("Row");
//dt<< delete columns("Interpolation Row");
Jim