Sinc filter

From HandWiki
Revision as of 16:13, 6 February 2024 by Smart bot editor (talk | contribs) (url)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: Ideal low-pass filter or averaging filter
The normalized sinc function, the impulse response of a sinc-in-time filter and the frequency response of a sinc-in-frequency filter.
The rectangular function, the frequency response of a sinc-in-time filter and the impulse response of a sinc-in-frequency filter.

In signal processing, a sinc filter can refer to either a sinc-in-time filter whose impulse response is a sinc function and whose frequency response is rectangular, or to a sinc-in-frequency filter whose impulse response is rectangular and whose frequency response is a sinc function. Calling them according to which domain the filter resembles a sinc avoids confusion. If the domain is unspecified, sinc-in-time is often assumed, or context hopefully can infer the correct domain.

Sinc-in-time

Sinc-in-time is an ideal filter that removes all frequency components above a given cutoff frequency, without attenuating lower frequencies, and has linear phase response. It may thus be considered a brick-wall filter or rectangular filter.

Its impulse response is a sinc function in the time domain:

[math]\displaystyle{ \frac{\sin(\pi t)}{\pi t} }[/math]

while its frequency response is a rectangular function:

[math]\displaystyle{ H(f) = \operatorname{rect} \left( \frac{f}{2B} \right) = \begin{cases} 0, & \text{if } |f| \gt B, \\ \frac{1}{2}, & \text{if } |f| = B, \\ 1, & \text{if } |f| \lt B, \end{cases} }[/math]

where [math]\displaystyle{ B }[/math] (representing its bandwidth) is an arbitrary cutoff frequency.

Its impulse response is given by the inverse Fourier transform of its frequency response:

[math]\displaystyle{ \begin{align} h(t) = \mathcal{F}^{-1} \{ H (f)\} &= \int_{-B}^B \exp(2\pi i f t) \, df \\ &= 2B \operatorname{sinc}(2 B t) \end{align} }[/math]

where sinc is the normalized sinc function.

Brick-wall filters

An idealized electronic filter with full transmission in the pass band, complete attenuation in the stop band, and abrupt transitions is known colloquially as a "brick-wall filter" (in reference to the shape of the transfer function). The sinc-in-time filter is a brick-wall low-pass filter, from which brick-wall band-pass filters and high-pass filters are easily constructed.

The lowpass filter with brick-wall cutoff at frequency BL has impulse response and transfer function given by:

[math]\displaystyle{ h_{LPF}(t) = 2B_L \operatorname{sinc}\left(2B_L t\right) }[/math]
[math]\displaystyle{ H_{LPF}(f) = \operatorname{rect}\left( \frac{f}{2B_L} \right). }[/math]

The band-pass filter with lower band edge BL and upper band edge BH is just the difference of two such sinc-in-time filters (since the filters are zero phase, their magnitude responses subtract directly):[1]

[math]\displaystyle{ h_{BPF}(t) = 2B_H \operatorname{sinc}\left(2B_H t\right) - 2B_L \operatorname{sinc}\left(2B_L t\right) }[/math]
[math]\displaystyle{ H_{BPF}(f) = \operatorname{rect}\left( \frac{f}{2B_H} \right) - \operatorname{rect}\left( \frac{f}{2B_L} \right). }[/math]

The high-pass filter with lower band edge BH is just a transparent filter minus a sinc-in-time filter, which makes it clear that the Dirac delta function is the limit of a narrow-in-time sinc-in-time filter:

[math]\displaystyle{ h_{HPF}(t) = \delta(t) - 2B_H \operatorname{sinc}\left(2B_H t\right) }[/math]
[math]\displaystyle{ H_{HPF}(f) = 1 - \operatorname{rect}\left( \frac{f}{2B_H} \right). }[/math]

Unrealizable

As the sinc-in-time filter has infinite impulse response in both positive and negative time directions, it is non-causal and has an infinite delay (i.e., its compact support in the frequency domain forces its time response not to have compact support meaning that it is ever-lasting) and infinite order (i.e., the response cannot be expressed as a linear differential equation with a finite sum). However, it is used in conceptual demonstrations or proofs, such as the sampling theorem and the Whittaker–Shannon interpolation formula.

Sinc-in-time filters must be approximated for real-world (non-abstract) applications, typically by windowing and truncating an ideal sinc-in-time filter kernel, but doing so reduces its ideal properties. This applies to other brick-wall filters built using sinc-in-time filters.

Stability

The sinc filter is not bounded-input–bounded-output (BIBO) stable. That is, a bounded input can produce an unbounded output, because the integral of the absolute value of the sinc function is infinite. A bounded input that produces an unbounded output is sgn(sinc(t)). Another is sin(2πBt)u(t), a sine wave starting at time 0, at the cutoff frequency.

Frequency-domain sinc

Filter transmission function of a 4sample group averaging filter

The simplest implementation of a sinc-in-frequency filter uses a boxcar impulse response to produce a simple moving average (specifically if divide by the number of samples), also known as accumulate-and-dump filter (specifically if simply sum without a division). It can be modeled as a FIR filter with all [math]\displaystyle{ N }[/math] coefficients equal. It is sometimes cascaded to produce higher-order moving averages (see Finite impulse response § Moving average example and cascaded integrator–comb filter).

This filter can be used for crude but fast and easy downsampling (a.k.a. decimation) by a factor of [math]\displaystyle{ N. }[/math] The simplicity of the filter (accumulate [math]\displaystyle{ N }[/math] data samples, output the accumulator result, zero the accumulator, and repeat) is foiled by its mediocre low-pass capabilities. Its poorest attenuation in the stop-band is -13.3 dB[2] and most high frequency components are only slightly more attenuated than that. An [math]\displaystyle{ N }[/math]-sample filter sampled at [math]\displaystyle{ f_S }[/math] will alias all non-fully attenuated signal components lying above [math]\displaystyle{ \frac{f_S}{2N} }[/math] to the baseband ranging from DC to [math]\displaystyle{ \frac{f_S}{2N}. }[/math]

Filter transmission function of a 32sample group averaging filter

A group averaging filter processing [math]\displaystyle{ N }[/math] samples has [math]\displaystyle{ \tfrac{N}{2} }[/math] transmission zeroes evenly-spaced by [math]\displaystyle{ \tfrac{f_S}{N}, }[/math] with the lowest zero at [math]\displaystyle{ \tfrac{f_S}{N} }[/math] and the highest zero at [math]\displaystyle{ \tfrac{f_S}{2} }[/math] (the Nyquist frequency). Above the Nyquist frequency, the frequency response is mirrored and then is repeated periodically above [math]\displaystyle{ f_S }[/math] forever.

The magnitude of the frequency response (plotted in these graphs) is useful when one wants to know how much frequencies are attenuated. Though the sinc function really oscillates between negative and positive values, negative values of the frequency response simply correspond to a 180-degree phase shift.

An inverse sinc filter may be used for equalization in the digital domain (e.g. a FIR filter) or analog domain (e.g. opamp filter) to counteract undesired attenuation in the frequency band of interest to provide a flat frequency response.[3]

See Window function § Rectangular window for application of the sinc kernel as the simplest windowing function.

transmission function of a 16sample group averaging filter working on a 1kHz input data rate, extended to 4x the Nyquist frequency

See also

References

External links