# Sinc Interpolation based on FFT

**URL:** <https://discourse.julialang.org/t/sinc-interpolation-based-on-fft/52512>\
**Category:** Signal and Image Processing\
**Tags:** fftw, interpolations, dsp\
**Created:** [December 28, 2020, 1:56pm UTC](https://discourse.julialang.org/t/sinc-interpolation-based-on-fft/52512 "2020-12-28T13:56:28Z")\
**Posts on this page:** 1\
**Showing post:** 82

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 5, 2021, 1:28pm UTC](https://discourse.julialang.org/t/sinc-interpolation-based-on-fft/52512/82 "2021-04-05T13:28:46Z")

</div>

> [@RainerHeintzmann](#):
>
> Maybe I can do a simulation of 100s of noisy signals which are filtered, to demonstrate how you probably get get a better estimate by the sqrt(2) scaling at the Nyquist sampling limit than by the mean (or sum as you mentioned).

You don’t need to do simulations, you can do this analytically. It simplifies a lot because (a) the DFT is linear and (b) the frequency components are orthogonal (when integrated over a common period), and the upshot is that you can analyze just the Nyquist term by itself:

In particular, take a function f(x)=a\_{+}e^{i\pi x}+a\_{-}e^{-i\pi x}, sampled at the Nyquist frequency f(n)=(a\_{+}+a\_{-})(-1)^{n} so we can only measure 2a=a\_{+}+a\_{-}. We reconstruct/interpolate it as a signal \tilde{f}(x)=2a\left[c\_{+}e^{i\pi x}+c\_{-}e^{-i\pi x}\right]. Question: what coefficients c\_{\pm} minimize the expected mean-square error E[\int|f(x)-\tilde{f}(x)|^{2}dx] if a\_{\pm} are i.i.d. random numbers with zero mean and some distribution (e.g. Gaussian)?

By explicit computation:

E\left[\frac{1}{2}\int\_{0}^{2}|f(x)-\tilde{f}(x)|^{2}dx\right] \\ = \frac{1}{2} E\left[\int\_{0}^{2}\left\{ |a\_{+}-2ac\_{+}|^{2}+|a\_{-}-2ac\_{-}|^{2}+\cancel{\#e^{2\pi ix}+\overline{\#}e^{-2\pi ix}}\right\} dx\right] \\ =E\left[|a\_{+}-2ac\_{+}|^{2}+|a\_{-}-2ac\_{-}|^{2}\right] \\ =E\left[|(1-c\_{+})a\_{+}|^{2}+|c\_{+}a\_{-}|^{2}+|(1-c\_{-})a\_{-}|^{2}+|c\_{-}a\_{+}|^{2}\right] \\ =E[|a\_{\pm}|^{2}]\left(|1-c\_{+}|^{2}+|c\_{+}|^{2}+|1-c\_{-}|^{2}+|c\_{-}|^{2}\right) \\ =E[|a\_{\pm}|^{2}]\left(1+2\left|\frac{1}{2}-c\_{+}\right|^{2}+2\left|\frac{1}{2}-c\_{-}\right|^{2}\right)

(using the facts that E[a\_{+}\overline{a\_{-}}]=0 and E[|a\_{+}|^{2}]=E[|a\_{-}|^{2}]), which is minimized for \boxed{c\_{\pm}=\frac{1}{2}}.

That is, the optimal interpolant is \boxed{\tilde{f}(x)=a\left[e^{i\pi x}+e^{-i\pi x}\right]}, which corresponds to splitting the Nyquist amplitude 2a equally between the positive- and negative-frequency terms. This also coincides with the minimal mean-square slope interpolant from [above](https://discourse.julialang.org/t/sinc-interpolation-based-on-fft/52512/77), and has the nice property that it interpolates real signals f (a\_- = \overline{a\_+} \implies a purely real) with real interpolants \tilde{f}. (The same analysis also works, with the same optimal interpolant \tilde{f}, if we average over purely real signals f with random a\_+=\overline{a\_-}, since in that case we still have E[a\_{+}\overline{a\_{-}}]=E[a\_+^2]=0 if the real and imaginary parts of a\_+ are i.i.d. with zero mean.)

No \sqrt{2}.

---

_[View the full topic](https://discourse.julialang.org/t/sinc-interpolation-based-on-fft/52512)._
