How can you repeat PWL waveform in LTspice?

One powerful feature of PWL sources in LTspice is the ability to automate waveform behavior using additional parameters.

LTspice allows edits of time/value pairs in the Advanced dialog. To explore other syntax elements of PWL, right-click on the PWL statement in the schematic to edit further. To create a repeating PWL waveform, add REPEAT and ENDREPEAT to the PWL statement.

Repeat a waveform

Repeat a waveform a fixed number of times:

PWL REPEAT FOR 5 (0 0 1m 1 2m 1 3m 0) ENDREPEAT

Repeat indefinitely:

PWL REPEAT FOREVER (0 0 1m 1 2m 1 3m 0) ENDREPEAT

Figure 4 shows the original PWL example, along with a version of that waveform that repeats five times, as well as a waveform that repeats indefinitely (create multiple plot panes by right-clicking on the waveform viewer and select Add Plot Pane Above/Below).


Figure 4. PWL waveforms constructed with REPEAT FOR and REPEAT FOREVER parameters.

Related Articles:
What is LTspice?
An Introduction to LTSpice
What is a Piecewise Linear (PWL) function in LTspice and when it should be used?
LTspice Tips - Mathematical Integration
LTspice Tips - Plot Manually Entered Functions