Salta al contenuto
Note per Studenti Aliasing and Anti-Aliasing Filters Report

Aliasing and Anti-Aliasing Filters

In questa pagina 3

Aliasing

Aliasing is an issue that arises when we violate the conditions of the sampling theorem (see Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem →), such as the band-limited (BL) assumption or the assumption on the Nyquist frequency.

Useful recalls: F[δ(t)]=1\mathcal{F}[\delta(t)]=1 and F[cos⁡(ω0t)]=π(δ(ω−ω0)+δ(ω+ω0))\mathcal{F}[\cos(\omega_0t)]=\pi\left(\delta(\omega-\omega_0)+\delta(\omega+\omega_0)\right). Notice the duality: narrow in time ⇔\Leftrightarrow wide over frequency.

We have seen that for x(t)∈L1(R)x(t)\in L^1(\mathbb{R}), X(jω)→0X(j\omega)\to0 as ω→∞\omega\to\infty. Hence in practice we can neglect the tails of ∣X(jω)∣|X(j\omega)| at very high frequency (we can filter out these high frequencies): xx is approximated by a band-limited signal.

If the Nyquist condition is violated, taking ωs<2ωM\omega_s<2\omega_M, the replicas of X(jω)X(j\omega) overlap. Summing the replicas, the ideal low-pass filter then preserves unwanted frequencies coming from the neighbouring replicas: this is aliasing.

Illustrative example

x(t)=cos⁡(4πt)x(t)=\cos(4\pi t): ω0=4π\omega_0=4\pi, f0=ω02π=2f_0=\frac{\omega_0}{2\pi}=2 Hz, T=12T=\frac12. Its Fourier transform is X(jω)=π(δ(ω−ω0)+δ(ω+ω0))X(j\omega)=\pi\left(\delta(\omega-\omega_0)+\delta(\omega+\omega_0)\right): two impulses of weight π\pi at ±4π\pm4\pi, so ωM=4π\omega_M=4\pi.

Suppose:

  1. ωs>2ωM\omega_s>2\omega_M, e.g. ωs=9π\omega_s=9\pi;
  2. ωs≤2ωM\omega_s\le2\omega_M, e.g. ωs=6π\omega_s=6\pi or ωs=8π\omega_s=8\pi. This violates the sampling theorem and produces aliasing: literally, we no longer distinguish or reconstruct the original signal we were given.

Case 1, ωs=9π\omega_s=9\pi. The replicas of the impulses sit at ±4π+n⋅9π\pm4\pi+n\cdot9\pi; the nearest ones are at ωs−ωM=9π−4π=5π\omega_s-\omega_M=9\pi-4\pi=5\pi and ωs+ωM=13π\omega_s+\omega_M=13\pi (and their mirror images). An ideal low-pass filter with a passband that contains ±4π\pm4\pi but not ±5π\pm5\pi preserves the original impulses and cuts out the rest: xx is recovered.

Case 2, ωs=6π\omega_s=6\pi. The replicas of the impulses at ±4π\pm4\pi fall at 6π−4π=2π6\pi-4\pi=2\pi and −6π+4π=−2π-6\pi+4\pi=-2\pi, inside the passband needed to keep ±4π\pm4\pi. With an ideal low-pass filter we cannot reject the replicas: it is impossible to retain just the original content. There are two extra impulses δ(ω±2π)\delta(\omega\pm2\pi), which after F−1\mathcal{F}^{-1} give an extra cos⁡(2πt)\cos(2\pi t):

xr(t)=cos⁡(4πt)+cos⁡(2πt)≠x(t),x_r(t)=\cos(4\pi t)+\cos(2\pi t)\ne x(t),

so we cannot recover the original signal.

Case ωs=8π=2ωM\omega_s=8\pi=2\omega_M. The replica impulses at 8π−4π=4π8\pi-4\pi=4\pi coincide with the original ones and add up, so F−1\mathcal{F}^{-1} gives 2cos⁡(4πt)≠x(t)2\cos(4\pi t)\ne x(t).

Observation. ωs=2ωM\omega_s=2\omega_M is not sufficient to prevent aliasing in general, due to the potential presence of impulsive terms at the edge of the band. (This is why the sampling theorem has a strict inequality.)

Anti-aliasing filters

In practice the Fourier transform of x(t)x(t) has a bump around the origin and tails that never vanish exactly. The sampling period TsT_s is the design parameter, with ωs=2πTs\omega_s=\frac{2\pi}{T_s}. By the sampling theorem we can reconstruct exactly the original signal if ωM<ωs2\omega_M<\frac{\omega_s}2. The parts of ∣X(jω)∣|X(j\omega)| beyond ±ωs2\pm\frac{\omega_s}{2} (the tails, hatched in the notes' sketch) will always overlap in practice, leading to aliasing.

The approach of anti-aliasing filters is pre-filtering the original signal: since we already know that ωM\omega_M must be bounded, we remove the high frequencies before sampling. For this task we use low-pass filters:

HAA(jω)=rect ⁣(ω2ωA).H_{AA}(j\omega)=\mathrm{rect}\!\left(\frac{\omega}{2\omega_A}\right).

We are going to lose some information, sure, but

X~p(jω):=repωs ⁣[HAA(jω)X(jω)]\tilde X_p(j\omega):=\mathrm{rep}_{\omega_s}\!\left[H_{AA}(j\omega)X(j\omega)\right]

will not exhibit overlaps. HAA(jω)H_{AA}(j\omega) guarantees no overlap if ωA≤ωs2\omega_A\le\frac{\omega_s}2, and ωA=ωs2\omega_A=\frac{\omega_s}2 is the best choice, as it saves as much content as possible.

Important practical remark: analog-to-digital converters with high ωs\omega_s are expensive, which is why ωs\omega_s cannot simply be raised.

The sampling system must therefore be redesigned. The earlier chain x(t)→⊗ (p)→xp→H→xrx(t)\to\otimes\ (p)\to x_p\to H\to x_r gives xr≠xx_r\ne x if xx is not band-limited (the assumptions were: xx band-limited and ωs>2ωM\omega_s>2\omega_M). The new chain is

x(t)→HAA→x~(t)→⊗ (p(t))→x~p(t)→H→xr(t)≈x(t),xr=x~.x(t)\to\boxed{H_{AA}}\to\tilde x(t)\to\otimes\ (p(t))\to\tilde x_p(t)\to\boxed{H}\to x_r(t)\approx x(t),\qquad x_r=\tilde x .

Exercises on sampling and aliasing

Convention in the exercises: the Fourier transform variable is f=ω2πf=\frac\omega{2\pi} (in Hz), so that there is no factor 12π\frac1{2\pi} in the convolution theorem, and Λ(f)=(1−∣f∣) rect ⁣(f2)\Lambda(f)=(1-|f|)\,\mathrm{rect}\!\left(\frac f2\right) is the unit triangle supported on [−1,1][-1,1].

Exercise 1

Given s(t)s(t) with Fourier transform S(f)=2 Λ ⁣(f5)S(f)=2\,\Lambda\!\left(\frac f5\right) (a triangle of height 22 supported on [−5,5][-5,5] Hz), let y(t)=2cos⁡2(20πt) s(t),y(t)=2\cos^2(20\pi t)\,s(t), sampled using fs=20f_s=20 Hz.

  1. Is it necessary to use an anti-aliasing filter before sampling? If yes, design HAA(f)H_{AA}(f).
  2. Compute the energy of the reconstruction error r(t):=y(t)−y~(t)r(t):=y(t)-\tilde y(t) where y~\tilde y is the output of the chain y→HAA→⊗(p)→ILPF→y~y\to H_{AA}\to\otimes(p)\to\text{ILPF}\to\tilde y.
  3. Is it possible to obtain the same reconstruction error using a lower fsf_s?

Solution.

  1. We need to check whether fsf_s satisfies the sampling theorem, i.e. fs>2fMf_s>2f_M with fMf_M the maximum frequency in Y(f)Y(f). Work in the frequency domain with the convolution theorem: Y(f)=S(f)∗F ⁣[2cos⁡2(20πt)].Y(f)=S(f)*\mathcal{F}\!\left[2\cos^2(20\pi t)\right]. By the double-angle formula 2cos⁡2α=1+cos⁡2α2\cos^2\alpha=1+\cos2\alpha, F ⁣[2cos⁡2(20πt)]=F ⁣[1+cos⁡(40πt)]=δ(f)+12(δ(f−20)+δ(f+20))(f0=20 Hz),\mathcal{F}\!\left[2\cos^2(20\pi t)\right]=\mathcal{F}\!\left[1+\cos(40\pi t)\right]=\delta(f)+\tfrac12\left(\delta(f-20)+\delta(f+20)\right)\quad(f_0=20\text{ Hz}), Y(f)=2Λ ⁣(f5)+Λ ⁣(f−205)+Λ ⁣(f+205).Y(f)=2\Lambda\!\left(\tfrac f5\right)+\Lambda\!\left(\tfrac{f-20}5\right)+\Lambda\!\left(\tfrac{f+20}5\right). Sketch: a central triangle of height 22 on [−5,5][-5,5] and two triangles of height 11 centred at ±20\pm20 and supported on [15,25][15,25] and [−25,−15][-25,-15]. Thus fM=25f_M=25 Hz and fs=20 Hz<2fM=50f_s=20\text{ Hz}<2f_M=50 Hz: the sampling theorem conditions are violated, so we need HAA(f)H_{AA}(f). Given fs=20f_s=20 Hz we can reconstruct y(t)y(t) if fM<10f_M<10 Hz, so the cut-off is fA:=fs2=10f_A:=\frac{f_s}2=10 Hz (best possible choice): HAA(f)=rect ⁣(f2fA).H_{AA}(f)=\mathrm{rect}\!\left(\frac f{2f_A}\right). After the filter only the central triangle survives: Y~(f)=2Λ(f5)\tilde Y(f)=2\Lambda(\frac f5), supported on [−5,5][-5,5], so the signal yAy_A entering the sampler satisfies the sampling theorem and the reconstruction is perfect: y~(t)=yA(t)\tilde y(t)=y_A(t) for all t∈Rt\in\mathbb{R}.

  2. r(t)=y(t)−y~(t)⇒R(f)=Y(f)−Y~(f)=Λ ⁣(f−205)+Λ ⁣(f+205)r(t)=y(t)-\tilde y(t)\Rightarrow R(f)=Y(f)-\tilde Y(f)=\Lambda\!\left(\tfrac{f-20}5\right)+\Lambda\!\left(\tfrac{f+20}5\right) (the two outer triangles). By Plancherel's theorem, E∞[r]=∫−∞+∞∣r(t)∣2dt=∫−∞+∞∣R(f)∣2df=2∫−∞+∞∣Λ ⁣(f−205)∣2dfE_\infty[r]=\int_{-\infty}^{+\infty}|r(t)|^2dt=\int_{-\infty}^{+\infty}|R(f)|^2df=2\int_{-\infty}^{+\infty}\left|\Lambda\!\left(\tfrac{f-20}5\right)\right|^2df (the two triangles do not overlap), and shifting ff by 2020: =2∫−55∣Λ ⁣(f5)∣2df=4∫05(1−f5)2df=4∫05(1+f225−2f5)df=203.=2\int_{-5}^{5}\left|\Lambda\!\left(\tfrac f5\right)\right|^2df=4\int_0^5\left(1-\tfrac f5\right)^2df=4\int_0^5\left(1+\tfrac{f^2}{25}-\tfrac{2f}5\right)df=\frac{20}3 .

  3. Yes: the sampling theorem only needs fs/2f_s/2 to exceed the bandwidth 55 Hz of the central triangle, so every fs≥10f_s\ge10 Hz is fine; we can lower fsf_s down to fs′=10f_s'=10 Hz (i.e. fs2\frac{f_s}2 down to 55 Hz) with no impact on the error. Using HAA(f)=rect ⁣(f2fA′)H_{AA}(f)=\mathrm{rect}\!\left(\frac f{2f_A'}\right) with fA′=fs′2=5f_A'=\frac{f_s'}2=5 Hz, we get the same reconstruction error.

Exercise 2

Consider s(t)→FS(f)=e−∣f∣/2s(t)\xrightarrow{\mathcal{F}}S(f)=e^{-|f|/2}, f∈Rf\in\mathbb{R}.

  1. Is it possible to sample the signal s(t)s(t) and reconstruct it without error?
  2. Find the minimum fsf_s such that the reconstruction error has energy less than 2e\frac2e.

Solution.

  1. No, because S(f)S(f) is not band-limited (it is positive for all ff, a symmetric two-sided exponential with value 11 at the origin). To reconstruct s(t)s(t) perfectly we would need fMf_M finite, and fs>2fM=+∞f_s>2f_M=+\infty cannot be satisfied.
  2. Design a sampling system that satisfies the requirement: s(t)→HAA→sA(t)→⊗(p)→ILPF→s~(t)=sA(t)s(t)\to H_{AA}\to s_A(t)\to\otimes(p)\to\text{ILPF}\to\tilde s(t)=s_A(t), with HAAH_{AA} cutting at ±fs2\pm\frac{f_s}2 (the tails outside [−fs2,fs2][-\frac{f_s}2,\frac{f_s}2] are eliminated by HAAH_{AA}). The error is the part of S(f)S(f) outside this band: E∞[r]=∫∣R(f)∣2df=2∫fs/2+∞∣e−f/2∣2df=2∫fs/2+∞e−fdf=2(−e−f)∣fs/2+∞=2e−fs/2.E_\infty[r]=\int|R(f)|^2df=2\int_{f_s/2}^{+\infty}\left|e^{-f/2}\right|^2df=2\int_{f_s/2}^{+\infty}e^{-f}df=2\left(-e^{-f}\right)\Big|_{f_s/2}^{+\infty}=2e^{-f_s/2}. The requirement is 2e−fs/2<2e−1  ⟺  −fs2<−1  ⟺  fs>22e^{-f_s/2}<2e^{-1}\iff-\frac{f_s}2<-1\iff f_s>2 Hz.

Versione ripasso

  • Aliasing: overlap of spectral replicas when the sampling theorem hypotheses fail (not band-limited, or ωs≤2ωM\omega_s\le2\omega_M): the original signal can no longer be distinguished or reconstructed.
  • Example x=cos⁡(4πt)x=\cos(4\pi t), ωM=4π\omega_M=4\pi: ωs=9π\omega_s=9\pi is fine (nearest replica at 5π5\pi); ωs=6π\omega_s=6\pi adds impulses at ±2π\pm2\pi, giving cos⁡4πt+cos⁡2πt≠x\cos4\pi t+\cos2\pi t\ne x; ωs=8π=2ωM\omega_s=8\pi=2\omega_M gives 2cos⁡4πt≠x2\cos4\pi t\ne x (impulses add up), so ωs=2ωM\omega_s=2\omega_M is not enough.
  • Real signals have tails (X→0X\to0 as ω→∞\omega\to\infty for x∈L1x\in L^1), so aliasing is unavoidable without pre-filtering.
  • Anti-aliasing filter: pre-filter with HAA(jω)=rect(ω2ωA)H_{AA}(j\omega)=\mathrm{rect}(\frac\omega{2\omega_A}), ωA≤ωs2\omega_A\le\frac{\omega_s}2; best choice ωA=ωs2\omega_A=\frac{\omega_s}2 (keeps the most content). Chain: x→HAA→⊗p→H→xr≈xx\to H_{AA}\to\otimes p\to H\to x_r\approx x. High-ωs\omega_s converters are expensive.
  • Exercise 1: Y=2Λ(f5)+Λ(f−205)+Λ(f+205)Y=2\Lambda(\frac f5)+\Lambda(\frac{f-20}5)+\Lambda(\frac{f+20}5), fM=25>fs2=10f_M=25>\frac{f_s}2=10 so HAA=rect(f20)H_{AA}=\mathrm{rect}(\frac f{20}); error R=Λ(f∓205)R=\Lambda(\frac{f\mp20}5) terms, energy ∫∣R∣2df=203\int|R|^2df=\frac{20}3 (Plancherel); any fs≥10f_s\ge10 Hz gives the same error.
  • Exercise 2: S(f)=e−∣f∣/2S(f)=e^{-|f|/2} is not band-limited; with cut-off fs2\frac{f_s}2 the error energy is 2e−fs/2<2e  ⟺  fs>22e^{-f_s/2}<\frac2e\iff f_s>2 Hz.
  • Typical mistakes: choosing fsf_s without checking the highest frequency of the modulated signal (here 2525 Hz, not 55 Hz); filtering after sampling instead of before; forgetting that energy of the error is computed in frequency with Plancherel; forgetting the factor 22 from the two symmetric tails.

Teoria collegata