# Effect of Averaged Jitter on Signal Measurements¶

## The Problem¶

Consider a a repeating, time-domain signal that one is attempting to characterize by measuring with an oscilloscope or other, similar means. This signal may have both amplitude noise and jitter, and it is typical to smooth the signal by computing the average of many measured signal traces.

Amplitude noise will be removed from the signal subjected to sufficient averaging. However, jitter is more complicated in that, after averaging, there is a loss of signal amplitude at higher frequencies and thus signal distortion. This form of distortion is what is investigated here.

## Analytical Approach¶

In the following, $j$ represents complex unit and the Wikipedia definition of the Fourier transform is used.

Start by considering a signal time-domain signal $V(t)$ and its Fourier transform $\hat{V}(f)$. A time shift in the time domain is represented in the Fourier domain by: $$V(t - \delta t) \Longleftrightarrow \hat{V}(f) e^{-2 \pi j f\tau}$$ Assume normally distributed jitter with an RMS value of $\tau$. The probability density function (PDF) of the jitter is then given by: $$PDF(x) = \frac{1}{\tau \sqrt{2 \pi}} e^{-x^2/(2\tau^2)}$$ Integrating the jittered signal weighted by the PDF represents the signal that would be obtained if an infinite number of traces were measured and averaged. In practice one would measure enough traces to remove most of the noise and jitter. The actual value of enough depends on the desired accuracy and various practicle constraints. The integral in question can be evaluated as follows: \DeclareMathOperator{\erfi}{erfi} \begin{align} \bar{\hat V}(f) &= \int_{-\infty }^{\infty}{ \hat{V}(f) e^{-2 \pi f j x} PDF(x) dx } \\ &= \frac{\hat{V}(f)}{\tau \sqrt{2 \pi}} \int_{-\infty }^{\infty}{ e^{-2 \pi f j x} e^{-x^2/(2 \tau^2)} dx } \\ &= \frac{\hat{V}(f)}{\tau \sqrt{2 \pi}} \int_{-\infty }^{\infty}{ e^{-2 \pi f j x -x^2/(2 \tau^2)} dx } \\ &= \frac{\hat{V}(f)}{\tau \sqrt{2 \pi}} \left[ -j \tau \sqrt{\pi/2} e^{-2 f^2 \pi^2 \tau^2} \erfi \left({\frac{2 \pi f x^2 + j \tau}{\sqrt{2}x}} \right) \right]_{-\infty}^{\infty} \\ &= \frac{\hat{V}(f)}{\tau \sqrt{2 \pi}} \left[ \tau \sqrt{2\pi} e^{-2 f^2 \pi^2 \tau^2} \right] \\ &= \hat{V}(f) e^{-{(2 \pi f \tau)}^2 / 2} \\ &= \hat{V}(f) e^{-{(\omega \tau)}^2 / 2} \end{align}

Here, the integral was computed using integrals.wolfram.com, and the limits were evaluated by examing the asymptotic series and noting that $\erfi(z) \rightarrow z/|z|$ for large $|z|$.

The above equation shows how different frequencies are affected by the combination of jitter and averaging. In particular, it shows that once $\omega \tau$ becomes comparable to 1, the measured signal drops off very rapidly.

In [1]:
%matplotlib inline
from matplotlib import pyplot as plt
import numpy as np

f_tau = np.linspace(0, 0.5, 2000)
scale = np.exp(-(2*np.pi*f_tau)**2 / 2.0)
plt.plot(f_tau, scale)
plt.xlabel(r"$f \tau$")
_ = plt.ylabel("scale")

Figure 1: frequency content of a signal is scaled as a function of $f\tau$. When $f \tau > 0.1$ the frequency content is already significanlty reduced. Note that scale represents the scaling of magnitude; power scales as the square of magnitude and thus would be even more severely affected.

### Connection to Convolution in the Time-Domain¶

One can take one further step by noting that the second, scaling term is simply the Fourier transform of a Gaussion centered at zero and with a width of $\tau$. By noting that multiplication in the frequency-domain corresponds to convolution in the time domain, we can express the average of the jittered signal in the time-domain as: $$\bar{V}(t) = V(t) * \frac{1}{\tau\sqrt{2\pi}}e^{-t^2/(2 \tau^2)}$$
Here Equation 206 from Wikipedia's table of Fourier transforms has been used; note that the the convention used here for the Fourier transform corresponds to the first column of the table.

In other words: averaging a signal that has jitter $\tau$ is equivalent to convolving the unjittered signal with a Gaussian of width $\tau$.

## Simulation Approach¶

In this section, the effects of averaging and jitter are simulated to demonstrate the effects shown and also to act as a check for their derivation.

### Time-Domain¶

Count traces are generated, each consisting of pulse randomly shifted by picking a shift from a normal distribution with $\sigma$ of tau. These are averaged to examine the effects of the jitter plus averaging on a time-domain pulse. The averaged values are them compared with the expected values based on the convolutional formula derived previously.

In [2]:
tau = 0.05

def pulse(t, dt=0, width=1.0):
return (abs(t - dt) < width/2.0)

def jittered_signals(t, tau, count=10000):
signals = []
for i in range(count):
dt = np.random.normal(0, tau)
signals.append(pulse(t, dt))
return np.asarray(signals)

t = np.linspace(-2, 2, 2000)
dt = t[1] - t[0]

f, (ax1, ax2) = plt.subplots(2, sharex=True, sharey=True)
baseline = pulse(t)
signals = jittered_signals(t, tau)
averaged = signals.mean(axis=0)
kernel = dt * np.exp(-0.5*t**2/(tau)**2) / (tau*np.sqrt(2*np.pi))
expected = np.convolve(baseline, kernel, mode="same")

for s in signals[::10]:
ax1.plot(t, s, 'k', alpha=0.01)

ax2.plot(t, baseline, 'k', label="baseline")
ax2.plot(t, averaged, 'b', linewidth=2, label="averaged")
ax2.plot(t, expected, 'r--', linewidth=2, label="expected")
ax2.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
_ = ax1.set_ylim(-.5, 1.5)

Figure 2: A set of jittered signals (top) and the baseline signal compared with the average of the jittered signal as well as the analytically expected value from the previous section (bottom). Note that we get essentially exact agreement between the analytical result and the computed result.

### Frequency domain¶

The Fourier transform of both the averaged and baseline signals is computed to examine the effects of averaged jitter in the frequency domain. The ratio of the averaged and baseline corresponds to the scale factor determined in the Analytical section.

In [3]:
f = np.arange(len(baseline)) / 4.0
V0 = np.fft.fft(baseline)
V1 = np.fft.fft(averaged)

fig, (ax1, ax2) = plt.subplots(2, sharex=True)

# Only half of the terms, in the FT are nonzero due to
# symmetry. So we drop the zero (in this case odd) terms
ax1.plot(f[1::2], abs(V1)[1::2], 'b', linewidth=2, label="averaged")
ax1.plot(f[1::2], abs(V0)[1::2], 'r--', linewidth=2, label="baseline")

ax1.legend(loc=0)
ax2.set_xlim(0,10)
ax2.set_xlabel("f")
ax2.plot(f[1::2], abs(V1[1::2]/V0[1::2]), 'b', linewidth=2, label="ratio")
ax2.plot(f_tau / tau, scale, 'r--', linewidth=2, label="scale")
_ = ax2.legend(loc=0)

Figure 3: The Fourier transform of the averaged and baseline signals (top) and the ratio of the averaged and baseline Fourier transforms compared to the scale factor derived in the analytical section above (bottom).

## Summary¶

If a periodic signal that has Gaussian jitter is averaged enough to remove the jitter, there is a loss of high frequency content from the signal. The ratio of the frequency content in the averaged, jittered signal to that of the unjittered signal is given by: $$e^{-{(2 \pi f\tau)}^2 / 2} = e^{-\omega^2\tau^2 / 2}$$ where $\tau$ is the RMS value of the jitter. In the time domain, the averaged signal is equal to the convolution of the unjittered signal with a Gaussian of width $\tau$: $$\bar{V}(t) = V(t) * \frac{1}{\tau \sqrt{2\pi}}e^{-t^2/(2 \tau^2)}$$