LTspice
Production
LTspice® is a powerful, fast, and free SPICE simulator software, schematic capture and waveform viewer with enhancements and models for improving the simulation...
LTspice on Analog.com
Continuing our journey with FIR filter models in LTspice, I’ll take a deeper dive into .AC and .NOISE measurements, using an alternative FIR model to demonstrate measurements that can be made to verify two different modeling techniques are equivalent.
In my February blog post, I introduced some blocks that can model a simple FIR filter in LTspice. In April, I explored combining that digital filter model with analog circuit elements, and demonstrated how to make simple observations with both .AC and .NOISE analyses.
Recall our initial FIR implementation was an average of consecutive samples:
where M is the number of samples. If we expand the summation for an example of averaging three samples:
Chapter 15 of The Scientist & Engineer's Guide to Digital Signal Processing shows an alternative mathematical implementation on page 283 that uses recursion. My creative interpretation of that equation is:
where M is still the number of samples to average. The output sample (y[n]) is equal to the previous output sample (y[n-1]), with the current input sample added on (x[n]), and the last input sample popped off (x[n-M]).
To implement a recursive FIR, we need two new model blocks: a delay-by-N block, and an adder block adding three signals. These are minor variations of the blocks introduced in February’s blog post, allowing us to build the functionality we need with a clean schematic.

Figure 1: Two Implementations of an FIR Filter Model in LTspice
Let’s prove this implementation is equivalent to the first before exploring the benefits of the recursive implementation.
To explore this example, open the FIR Filter Implementations.asc file in the attached .zip file. For LTspice to find all the necessary files, you will need to unzip the .zip file before opening the schematic file.
Select Simulate -> Run/Pause from the menu to run the AC simulation specified in the .AC directive on the schematic. Figure 2 shows both inputs (top pane) and outputs (bottom pane) overlaid on each other.

Figure 2: Frequency Response at the Inputs and Outputs of Each FIR Filter Model
This allows us to quickly observe that the AC responses of these filters are identical. Overlaying results for .NOISE simulations is not nearly as straightforward; but I’ll show you a trick…
Shift-click on the active .AC directive to comment it out. Right-click on the .STEP directive to bring up the text editor (Figure 3).

Figure 3: Text Block of Multiple Directives: Converting from Comment to Active Directive
This text block contains multiple directives that can be commented/uncommented as a group. Click on the SPICE directive radio button to convert this text from a comment to an active set of directives and click OK. Run the simulation.
Now we need to get creative to view the results. Type A to add a trace to the plot, and select v(onoise). Once the waveforms are plotted, right-click on the waveform window and select Notes & Annotations -> Annotate Steps, and place the step legend on the waveform window (Figure 4). Visit the blog post on using .STEP and .MEAS directive in .NOISE simulations to review some of the basic concepts of using the .STEP directive.

Figure 4: Stepping Through Multiple Output Nodes in a .NOISE Simulation
Right-click on the plot and select View -> Select Steps. Use this dialog to control which noise results are plotted.

Figure 5: Selecting which .STEP Results are Plotted
In this example, I’m using the .STEP directive to step through output nodes in my noise simulation:
.step param n list 0 1 2 3.param noise_outnode=select(n, "INA", "OUTA", "INB", "OUTB")
In the first step (n=0), I’m examining the noise at the INA node: the noise generated by R1 and shaped by the filter formed by R1 and C1. In the second step (n=1), I’m examining the noise at the OUTA node; the noise that is further shaped by the digital filter.
Right-click on the .MEAS directives to bring up the text editor (Figure 6). Click on the SPICE directive radio button to convert this text from a comment to an active set of directives and click OK. Run the simulation.

Figure 6: .MEAS Directives to Measure Integrated Noise for Each .STEP Simulation
Click on the schematic to ensure it is the active window, and select View -> SPICE Output Log (Figure 7). Here we can see the integrated noise at INA (n=0), OUTA (n=1), INB (n=2), and OUTB (n=3).

Figure 7: SPICE Output Log with Integrated Noise Measurements
I’ve used three measurements to verify that these two filters behave identically: inspection of .AC waveforms, inspection of .NOISE waveforms, and automated .MEAS measurements of .NOISE simulation results.
What’s the advantage of using the recursive implementation? Look at how easy it is to change the number of averaged samples from three to 50:

Figure 8: Recursive FIR Averaging 50 Samples
These model blocks obviously don’t capture every aspect of a digital filter. But they are simple and efficient models that you can use to understand the overall signal and noise response of your combined analog circuitry and digital post-processing.
Throughout this three-part series, we've journeyed from basic FIR building blocks to clever LTspice measurement techniques that let you confidently validate your mixed-signal designs. You now have the tools to model digital signal processing in LTspice, seamlessly integrate it with analog circuitry, and rigorously verify your implementations using AC analysis, noise simulation, and automated measurements.
Read all the blogs in LTspice Digital Filters series.
Top Comments
-
in reply to AnneM +1-
in reply to AnneM-
in reply to getbetter-
in reply to AnneM-
in reply to AnneM-
in reply to getbetter