User-Defined Functions

(Right click menu)=>View=>Plot Defs allows you to enter your own function definitions and parameter definitions for use in the waveform viewer. These functions are kept in the file ~/Documents/LTspice/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 already internally defined constant pi of the waveform viewer.