Fourier analysis of real data sets

Consider a series of $N$ measurements $x_n$ that are made at equally spaced time intervals $\Delta t$. The total time to make the measurement series is $N\Delta t$. A discrete Fourier transform can be used to find a periodic function $x(t)$ with a fundamental period $N\Delta t$ that passes through all of the points. This function can be expressed as a Fourier series in terms of sines and cosines,

\[ \begin{equation} \label{eq:sines} x(t) = \sum\limits_{n=0}^{n < N/2}\left[c_n\cos\left(\frac{2\pi nt}{N\Delta t}\right)+s_n\sin\left(\frac{2\pi nt}{N\Delta t}\right)\right]. \end{equation} \]

Data for $x_n$ can be input in the textbox below. When the 'Calculate Fourier Coefficients' button is pressed, the periodic function $x(t)$ is plotted through the data points. The Fourier coefficients are tabulated and plotted as well. The fft algorithm first checks if the number of data points is a power-of-two. If so, it calculates the discrete Fourier transform using a Cooley-Tukey decimation-in-time radix-2 algorithm. If the number of data points is not a power-of-two, it uses Bluestein's chirp z-transform algorithm. The fft code was taken from Project Nayuki.

 $x_n$

$\Delta t =$

$x$

$t$

Fourier coefficients calculated
from the data above.

 $n$  $c_n$  $s_n$
$c_n$
$s_n$

$f$

Power spectrum

The power spectrum $S_{xx}$ specifies the power there is in the signal in every frequency interval. This quantity is sometimes called the power spectral density (PSD).

\[ \begin{equation} S_{xx} = c_n^2+s_n^2. \end{equation} \]

The notation comes from problems with more variables where $S_{xx}$ is the power spectrum of variable $x$, $S_{yy}$ is the power spectrum of variable $y$, and $S_{xy}$ describes the cross correlations of variables $x$ and $y$. The units of the power spectrum are $[x]^2/\text{Hz}$, where $[x]$ are the units of the variable $x$. If the measurement points represent a voltage, the units of $S_{xx}$ are $\text{V}^2/\text{Hz}$. Sometimes a noise signal is specified as the square root of $S_{xx}$. A voltage amplifier manufacturer might specify the voltage noise as $10 \text{nV}/\sqrt{\text{Hz}}$ @ 1 kHz. If they leave the specification @ 1 kHz out, it implies they are using the frequency at which the noise is the lowest.

 $f$  $S_{xx}$  $\sqrt{S_{xx}}$

For the plot, the $\sqrt{S_{xx}}$ curve was
scaled so that the peaks of the two
curves have the same amplitude.

$S_{xx}$

$f$

Digital filtering

A digital filter multiplies the Fourier coefficients by a filter function that can selectively enhance or suppress some frequency components of the signal. Some buttons are provided for filters but it is possible to use any mathematical expression involving $f$, $f_0$, and $f_1$ as the filter function.

Filter function:

$f_0 =$  $f_1 =$

$a_n$
$b_n$

$f$

Filtered fit function $x(t)$

 $t$  $x$
$x$

$t$

Often in an experiment, a preamplifier acts like a digital filter. Usually an amplifier acts like a lowpass filter where the cut-off frequency is lower for higher amplification settings. Sometimes a capacitor is put in series with the amplifier to achieve ac-coupling. In this case the amplifier acts like a bandpass filter.

Numerical differentiation and integration

The Fourier series can be used to estimate the derivative and the integral of the data series. The derivative is,

\[ \begin{equation} \frac{dx}{dt} = \sum\limits_{n=1}^{n < N/2}\frac{2\pi n}{N\Delta t}\left[-c_n\sin\left(\frac{2\pi nt}{N\Delta t}\right)+s_n\cos\left(\frac{2\pi nt}{N\Delta t}\right)\right]. \end{equation} \]

The high frequency components get amplified by a factor of $f$ when the derivative is taken so it is often useful to filter out the high frequency noise before differentiating. The derivative of the filtered fit is tabulated and plotted below.

 $t$  $\frac{dx}{dt}$
$\frac{dx}{dt}$

$t$

The integral of the Fourier series is,

\[ \begin{equation} \int\limits_0^{t}x(t')dt' = a_0t+\sum\limits_{n=1}^{n < N/2}\frac{N\Delta t}{2\pi n}\left[c_n\sin\left(\frac{2\pi nt}{N\Delta t}\right)-s_n\left(\cos\left(\frac{2\pi nt}{N\Delta t}\right)-1\right)\right]. \end{equation} \]

Here the integration constant was chosen so that the integral is zero at $t=0$. The integral of the filtered fit is tabulated and plotted below.

 $t$  $\int\limits_0^{t}xdt'$
$\int\limits_0^{t}xdt'$

$t$