**Click+Drag**

over an existing opened instance of LTspice.While the order can be internally determined if **Kaiser**, **exponential**, **hyperbolic cosine** or **Dolph-Chebyshev**. The same notes and golden rule apply here, as well.

*N=0*

, it's not the recommended way to do it for other windows than - Even if

is listed as a parameter, its only purpose is to ensure unity weights, which means the only setting for it is*Win*

.*Win=1* - In the same manner,

's only "choice" is*Choice*

, which is selecting the*0***moving average**function. - The
*Filter*already has two moving average at the end of the list, but the difference between them is that here it's implementated with delays, sums and weights, while the others are analog approaches.

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:Win=1 Choice=0 sim=x test=x SH=0 Fact=1 f0=2 G=1 N=129

*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.According to the table, there are fixed and parametric windows, the last ones being a function of **hyperbolic cosine** exception).

*sigma*

or *As*

(or both, for the __Low-pass__

Using a fixed window, a **Hann** window LP, with

*129*

taps *ω*_{c}=π/4

, at *2Hz*

sampling frequency and unity gain. The graphs show the conditions for a LP. Since there is no specified transition width, all there is to do is to make sure the values for *BWp*

and *BWs*

satisfy the above condition: *π/4=0.25Hz*

⇒ *(BWp+BWs)/2=0.25*

; the values of *0.2*

and *0.3*

are chosen.*nT*

sets both unnormalized gain (*nT=-1*

) and the values of the multipliers at the ends of the window (*nT=1*

), so having both is impossible. Gain normalization is for *nT≥0*

so, since the *nT=1*

(it can be `.stepped`

). In rest, this is a frequency analysis, so *SH=0*

and it's a normal filter, *Fact=1*

. The parameters to set are these:nT=1 Win=12 Choice=1 sim=x test=x SH=0 Fact=1 f0=2 fc=0 BWp=0.2 BWs=0.3 G=1 N=129

The time domain analysis is for a step response.

The parametric windows as a function of **Gaussian** window for the same conditions as above, only made as a HP:

*sigma*

provide a bit more flexibility in design. A generic sigma={sigma} nT=1 Win=25 Choice=1 sim=x test=x SH=0 Fact=1 f0=2 fc=0 BWp=0.3 BWs=0.2 G=1 N=129

The

`.step`

line has a list of parameters which show that, even if the table lists the values for *sigma*

as ranging from *<+0..∞>*

, the practical values are different; in short, the designer's common sense should be the limit. The same applies to the others.The windows as a function of **Kaiser** is chosen for a

*As*

are the most flexible. *192kHz*

sampling frequency, *24kHz*

central frequency, pass-band of *20kHz@-6dB*

, *4kHz*

transistion width and *-80dB*

in the stop-band. Let the order be internally determined. According to the graphs:and so, the parameters are these:BWp = ω_{pb}-ω_{tw}BWs = BWp+2*ω_{tw}

Win=26 Choice=1 sim=x test=x SH=0 Fact=1 f0=192k fc=24k BWp=16k BWs=24k G=1 As=80 N=0

(reusing the same schematic)

Choosing **hyperbolic cosine** window which allows for both

*Win=29*

selects the *As*

and *sigma*

as variables: the former sets the stop-band attenuation, while the latter is the power of the window's function in time-domain: *hyperbolicCos(x)*^{σ}

. This one is the only exception.With **Kaiser**'s order determination, the same values as before only reversed

*BWp*

↔ *BWs*

and *Win=29*

.The result is that of a BP. The reason: pin *II*. Because of the way the filter is built, internally, the only valid responses for type *II* are LP, BP (i.e. no zero sample @*π/2*). The solution is to either increase/decrease the order or adjust the frequency/attenuation constraints.

`0.1`

shows *241V*

⇒ type Easily achieved as long as:

- it's configured to be a LP

, integer*ω*_{c}=π/k, k≥2- it's a type
*I*and*N/2=odd*

An example with FIR2 for the

*4th*

band with *-60dB*

attenuation:Choice=1 sim=x test=x SH=0 Fact=1 f0=2 fc=0 BWp=0.2 BWs=0.3 G=1 As=60 N=67

Which is similar to the LP example with the **Hann** window.

This example is used for comparison, with the same parameters but adapted to a *FIR*. The pass-band has been tweaked to have ~*IIR* example) and the gain is the same **Kaiser** window (for

*-3dB@5kHz*

(matching the *4⋅1.4142*

to aid in the `.TRAN`

simulation. In addition, a *N=0*

) and unnormlized gain:nT=-1 Win=26 Choice=1 sim=x test=x SH=0 Fact=1 f0=44.1k fc=0 BWp=4295 BWs=6025 G=-4*1.4142 As=120 N=0

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.Using normalized frequences (*Nyquist=1*), **exponential** window between a normal *FIR*:

*L=4, ω*_{p}=0.1

and *ω*_{s}=0.12

, a comparison with an sigma=1 nT=0 Win=28 Choice=1 sim=x test=x SH=1 Fact=1 f0=-2 fc=0 BWp=0.1 BWs=0.12 G=1 As=80 N=0

...and a two stage *IFIR*:

sigma=1 nT=0 Win=28 Choice=1 sim=x test=xSH=0Fact=-4 f0=-2 fc=0 BWp=0.1*4 BWs=0.12*4 G=1 As=80 N=0sigma=1 nT=0 Win=28 Choice=1 sim=x test=x SH=1 Fact=1 f0=-2 fc=0 BWp=0.1 BWs=1/L-0.12 G=1 As=80 N=0

The trick here is using *LTspice*'s point of view, it's better with one *S&H* at the output rather than with one on each branch; *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*

with *Fact=-L*

(or *L*

for interpolation), which is one exception for the golden rule. The explanation: decimation, from *SH=<0,1>*

disables or enables the *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 *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 (*0.01* to *0.6*, encompassing the aliasing region of the 1st stage of the *IFIR*.

*f0*

is for external sync (only one clock instead of another two, internally; faster). In `.AC`

, plotting *Win=26*

) will do. The `.TRAN`

sweep is from The same example will be used for all three: **raised cosine** and **root raised cosine** − or the **Gaussian**), a slightly exaggerated

*SPS=4*

(the oversampling factor, or samples per second), *β=0.22*

(the roll-off factor − for *BT*

product − for the *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:BWp = f0/(2⋅SPS)⋅(1-β) = 3.84Meg/(2⋅4)⋅(1-0.22) = 374.4k BWp = f0/(2⋅SPS)⋅(1+β) = 3.84Meg/(2⋅4)⋅(1+0.22) = 585.6k nT = 2⋅nr_sym = 2⋅12 = 24

wherenT=24 Win=1 Choice={Choice} sim=x test=x SH=0 Fact=1 f0=3.84Meg fc=0 BWp=374.4k BWs=585.6k G=1 N=0

*{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 **raised cosine** with **Dolph-Chebyshev** having an arbitrary

*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.: *-40dB*

attenuation in the stop-band; FIR2 needs to be used:nT=24 Choice=3 sim=x test=x SH=0 Fact=1 f0=3.84Meg fc=0 BWp=374.4k BWs=585.6k G=1 As=40 N=0

If **raised cosine** or **root raised cosine**, the parameters can be changed like this:

*β*

needs to be `.stepped`

for and thef0={f0} BWp={f0/2/SPS*(1-beta)} BWs={f0/2/SPS*(1+beta)}

`.param `

and `.step `

statements should be changed/added like this (left as an exercise):
.param f0=3840k SPS=4 beta=0.2 .step param beta 0 1 0.2

**Differentiator**...**Hilbert transformer**

...until

*0dB@π/2*

and a "don't care" transition band given by a *64*

tap type *192kHz*

:
nT=0 a0=0.48 a1=0.5 a2=0.08 a3=0 a4=0 Win=11 Choice=5 sim=x test=x SH=0 Fact=1 f0=192k fc=0 BWp=48k BWs=60k G=1 N=64

*nT=0*

is because of the imposed gain @*ω*_{c}

and the window chosen is the *a[0:4]=[0.42, 0.5, 0.08, 0, 0]*

, making it a *Win=16*

, but this is for the sake of the example (*Zin*

and *Zout*

, unused, were deleted to make room, a practice not encouraged).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.Using FIR_FS isn't quite as straightforward as the other ones:

- First,
*filter.sub*must be opened with a text editor. - Once inside, a search for "
`.subckt FIR_FS`

" will lead to the subcircuit of the FIR_FS. - Scrolling down a few lines there is a function defined as

and a few other, similar, but commented out (these are examples). Considering the description, the*.func fspl(x) {...}*`.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*

:sigma=x nT={nT} Win=1 Choice=1 sim=x test=x SH=0 f0=2 N={N}

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.

(reusing this schematic)__The test pins__

Any schematic so far can be reused to view the coefficients, *h[n]*, and the weights, *w[n]*, in **Hann** window.

`.TRAN`

. The schematic reused here can also show the differences between *nT=0*

and *nT=1*

for the ©Vlad, 2008 - 2015