Note: Do not save the schematics after usage because they may be used in later examples.
Note: Opening the schematics from the links is best done with a Click+Drag over an existing opened instance of LTspice.

While the order can be internally determined if N=0, it's not the recommended way to do it for other windows than Kaiser, exponential, hyperbolic cosine or Dolph-Chebyshev. The same notes and golden rule apply here, as well.
TOP
Following the example in the table, a moving average is configured with only these parameters: SH, f0, G and N, so the final configuration looks like this:
sim and test here are quite redundant since the weights are all 1 and the coefficients are all 1/N. Fact≠1 can also be used, has an impact on the final result, but it's pointless.
The time domain shows an averaged inverted cosine with DC.
SH allows continuous time signal at the output (SH=0), or sampled (SH=1), user's choice. This goes against the golden rule, but can be regarded as a small useful cheat.
TOP
According to the table, there are fixed and parametric windows, the last ones being a function of sigma or As (or both, for the hyperbolic cosine exception).
TOP
Easily achieved as long as:
An example with FIR2 for the 4th band with -60dB attenuation:
Which is similar to the LP example with the Hann window.
TOP
This example is used for comparison, with the same parameters but adapted to a FIR. The pass-band has been tweaked to have ~-3dB@5kHz (matching the IIR example) and the gain is the same 4⋅1.4142 to aid in the .TRAN simulation. In addition, a Kaiser window (for N=0) and unnormlized gain:
The negative gain is to better compare the output to the analog signal in .TRAN. SH=1 is mandatory for time domain analysis of interpolation/decimation.
TOP
Using normalized frequences (Nyquist=1), L=4, ωp=0.1 and ωs=0.12, a comparison with an exponential window between a normal FIR:
...and a two stage IFIR:
The trick here is using SH=0 with Fact=-L (or L for interpolation), which is one exception for the golden rule. The explanation: decimation, from LTspice's point of view, it's better with one S&H at the output rather than with one on each branch; SH=<0,1> disables or enables the S&H, but the delays are still z-L, which is exactly what's needed for the 1st stage (here) of the IFIR. Still, care should be taken that the input is properly sampled because if SH=0, external synchronization is not possible.
The order is automatically determined after Kaiser's formula, which gives a very close approximation for this type of window (and the hyperbolic cosine). The negative f0 is for external sync (only one clock instead of another two, internally; faster). In .AC, plotting V(b)/V(a) will show the response of the 2nd stage, only. It can be seen that the exponential window doesn't exactly meet the specifications, but here it's used for the sake of exemplification; if exact matching is desired, the Kaiser window (Win=26) will do. The .TRAN sweep is from 0.01 to 0.6, encompassing the aliasing region of the 1st stage of the IFIR.
TOP
The same example will be used for all three: SPS=4 (the oversampling factor, or samples per second), β=0.22 (the roll-off factor − for raised cosine and root raised cosine − or the BT product − for the Gaussian), a slightly exaggerated nr_sym=±12 (the number of symbol periods, or samples, per second) and 3.84MHz sampling frequency.
The math for determining the parameters is common to all:
which, considering a rectangular window and unity gain, give the following parameters: where {Choice} is externally defined as a .param and sets the pulse-shaping window according to the values ennumerated in the table. The unscaled gain for the pulse-shaping windows can be verified with nT=-1.
While Choice=2 and Win>1 is possible, it isn't done in practice so it should be avoided; the other two allow windowing, though. E.g.: raised cosine with Dolph-Chebyshev having an arbitrary -40dB attenuation in the stop-band; FIR2 needs to be used:
If β needs to be .stepped for raised cosine or root raised cosine, the parameters can be changed like this:
and the .param and .step statements should be changed/added like this (left as an exercise):
TOP
  1. Differentiator...

  2. ...until 0dB@π/2 and a "don't care" transition band given by a 64 tap type IV. The sampling frequency is 192kHz:
    nT=0 is because of the imposed gain @ωc and the window chosen is the general cosine (which has the terms hidden): a[0:4]=[0.42, 0.5, 0.08, 0, 0], making it a Blackman. The same could have been achieved by letting Win=16, but this is for the sake of the example (Zin and Zout, unused, were deleted to make room, a practice not encouraged).

  3. Hilbert transformer

  4. To reuse the schematic, Choice=6.
The results of both can be viewed in .AC or .TRAN. For the time domain simulation, both digital and analog signals can be used with the same cheat.
TOP
Using FIR_FS isn't quite as straightforward as the other ones:
  1. First, filter.sub must be opened with a text editor.
  2. Once inside, a search for ".subckt FIR_FS" will lead to the subcircuit of the FIR_FS.
  3. Scrolling down a few lines there is a function defined as .func fspl(x) {...} and a few other, similar, but commented out (these are examples). Considering the description, the .func can now be expressed in an LTspice-friendly manner.
For this case, the "linear phase Butterworth" can be uncommented while commenting out the default fspl(x). From here on, the windows can be applied with Win, the types can be chosen through Choice and odd/even sampling through nT:
Here, N and nT are externally defined to allow .stepping their values. The transient step response can also be viewed if the cards are switched between themselves.
TOP
Any schematic so far can be reused to view the coefficients, h[n], and the weights, w[n], in .TRAN. The schematic reused here can also show the differences between nT=0 and nT=1 for the Hann window.
TOP





































































































©Vlad, 2008 - 2015