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 %HOMEPATH%\Documents\LTspiceXVII\plot.defs.

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

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