User-Defined Functions

The menu command Plot Settings=>Edit Plot Defs File allows you to enter your own function definitions and parameter definitions for use in the waveform viewer. These functions are kept in the file plot.defs in the same directory as the LTspiceIV executable, scad3.exe.

 

Then the syntax is the same as the .param and .func statements used for parameterized circuits. E.g., the line

 

.func Pythag(x,y) {sqrt(x*x+y*y)}

 

defines the function Pythag() to be the square root of the sum of its two arguments.

 

Similarly, the line

 

.param twopi = 2*pi

 

would define twopi to be 6.28318530717959. Note that it uses the already internally defined constant pi of the waveform viewer.