列自訂公式我想在我的表中添加一個新列“Vth”,並進行以下計算:-
首先,我需要找到「Id」列的索引 i,其中「Id」最接近 1e-6;則 Vth = Vg(i)。 它也應該按 Mod 和 Device 列分組。 也就是說,Mod 和 Device 的每一種獨特組合都將具有一個 Vth 值。
| ID | 電壓 | 模組 | 裝置 | 電壓 |
| 2.00E-06 | 3 | 1A | X1 | |
| 2.00E-07 | 2.8 | 1A | X1 | |
| 2.00E-08 | 2.6 | 1A | X1 | |
| 2.00E-09 | 2.4 | 1A | X1 | |
| 2.00E-10 | 2.2 | 1A | X1 | |
| 2.00E-12 | 2 | 1A | X1 | |
| 3.00E-06 | 3 | 1B | X1 | |
| 3.00E-07 | 2.8 | 1B | X1 | |
| 3.00E-08 | 2.6 | 1B | X1 | |
| 3.00E-09 | 2.4 | 1B | X1 | |
| 3.00E-10 | 2.2 | 1B | X1 | |
| 3.00E-12 | 2 | 1B | X1 | |
| 4.00E-06 | 3 | 1A | Y1 | |
| 4.00E-07 | 2.8 | 1A | Y1 | |
| 4.00E-08 | 2.6 | 1A | Y1 | |
| 4.00E-09 | 2.4 | 1A | Y1 | |
| 4.00E-10 | 2.2 | 1A | Y1 | |
| 4.00E-12 | 2 | 1A | Y1 | |
| 5.00E-06 | 3 | 1B | Y1 | |
| 5.00E-07 | 2.8 | 1B | Y1 | |
| 5.00E-08 | 2.6 | 1B | Y1 | |
| 5.00E-09 | 2.4 | 1B | Y1 | |
| 5.00E-10 | 2.2 | 1B | Y1 | |
| 5.00E-12 | 2 | 1B | Y1 | |
資料混合與清理回覆:列自訂公式以下是產生您所要求的內容的列。我照原樣採用了你的插值公式,並實現了它。您可能需要改變一些事情。
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=""> 0,
iRow = theRow - 1,
.000001 - :ID[theRow] < 0,
iRow = theRow +1,
iRow = theRow
);
);
));
iRow;
// Set the Vth
dt<<NEW column=""></NEW></NEW>回覆:列自訂公式謝謝吉姆。 有用。 我該如何修改它以找到 Vth透過插值,它恰好對應於 ID 的 1e-6。 即找到ID的1e-6前後的索引然後進行內插。
索引=最接近 1e-6(大於 1e-6)
插值( x, [VG(索引) VG(索引-1) ], [log10(ID(索引)) log10(ID(索引-1))] );
回覆:列自訂公式這是一個小腳本,它會建立 2 個新列,為您提供所需的結果。下圖已刪除臨時列,因為它只是一個工作列。
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,
theValue = Row()
);));
// Set the Vth
dt<<NEW column=""></NEW>