在LTspice中,我们可以自定义函数。语法如下:
.func <name>([args]) {<expression>}
func是function的缩写;name是自定义函数名;args是arguments的缩写,即函数参数,参数的个数没有限制;expression是函数表达式。
我们放置一个Arbitary behavioral voltage source,演示func指令的用法。
- 定义一个参数:.func myfunction(x) {x * x}
- 定义两个参数:.func myfunction(x,y) {x * x + 2 * y}
- 定义三个参数:.func myfunction(x,y,z) {x * x + 2 * y + z }
<<==上一篇:LTspice基础教程-026.测量平均值有效值;meas指令用法
>>==下一篇:LTspice基础教程-028.Timestep too small