Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lecture 12 Notes - Power Spectral Analysis

Periodic signals

We spoke previously about periodic signals

y(t):=β0+Rcos(2πft+ϕ)y(t) := \beta_0 + R \cos (2\pi f t + \phi)

which can also be re-parameterized as

y(t)=β0+U1cos2πft+U2sin2πfty(t) = \beta_0 + U_1 \cos 2\pi ft + U_2 \sin 2\pi ft

where U1=AcosϕU_1=A\cos\phi and U2=RsinϕU_2=-R\sin\phi, and U1U_1 and U2U_2 are taken to be normally distributed random variables. The amplitude is A=U12+U22A=\sqrt{U_1^2+U_2^2} and the phase is ϕ=arctan(U2/U1)\phi=\arctan (U_2/U_1). If we assume that U1U_1 and U2U_2 are uncorrelated random variables with mean 0 and variance σ2\sigma^2, then we also can show that

y(t)y(t)

is stationary because E(yt)=0\mathbb{E}(y_t)=0 and λ=2πf\lambda = 2\pi f:

γy(t,s)=cov(yt,ys)=cov(U1cos(λt)+U2sin(λt),U1cos(λs)+U2sin(λs))=cov(U1cos(λt),U1cos(λs))+cov(U1cos(λt),U2sin(λs))+cov(U2sin(λt),U1cos(λs))+cov(U2sin(λt),U2sin(λs))=σ2cos(λt)cos(λs)+0+0+σ2sin(λt)sin(λs)=σ2[cos(λt)cos(λs)+sin(λt)sin(λs)]=σ2cos(λ(ts))\begin{aligned} \gamma_y(t,s) &= \text{cov}(y_t, y_s)\\ &= \text{cov} (U_1 \cos(\lambda t) + U_2 \sin (\lambda t), U_1 \cos(\lambda s) + U_2 \sin (\lambda s))\\ &= \text{cov} (U_1 \cos(\lambda t),U_1 \cos(\lambda s)) + \text{cov} (U_1 \cos(\lambda t),U_2 \sin(\lambda s)) + \\ & \quad \text{cov} (U_2 \sin(\lambda t),U_1 \cos(\lambda s)) +\\ & \quad \text{cov} (U_2 \sin(\lambda t),U_2 \sin(\lambda s))\\ &= \sigma^2 \cos (\lambda t) \cos (\lambda s) + 0 + 0 + \sigma^2 \sin (\lambda t) \sin(\lambda s)\\ &= \sigma^2 [\cos (\lambda t) \cos (\lambda s) + \sin (\lambda t) \sin (\lambda s)]\\ &= \sigma^2 \cos (\lambda(t-s)) \end{aligned}

Because this quantity depends only on the time lag tst-s. We can create a generalization of this signal that allows mixtures of periodic signals with multiple freqauencies and amplitudes:

yt=k=1q[Uk1cos(2πfkt)+Uk2sin(2πfkt)]y_t = \sum_{k=1}^q [U_{k1}\cos(2\pi f_k t) + U_{k2}\sin(2\pi f_k t)]

where Uk1,Uk2U_{k1},U_{k2} for k=1,2,,qk=1,2,\dots,q are uncorrelated zero-mean random variables with variances σk2\sigma^2_k and fkf_k are distinct frequencies.

Let’s look at some examples of these mixtures of frequencies in the accompanying jupyter notebook.

Periodogram

Now let’s say we wanted to estimate the component frequencies of a signal like this, where we didn’t know what the underlying components were. One way to do this is using the periodogram.

For any time series, we can write:

yt=a0+j=1n/2[ajcos(2πtj/n)+bjsin(2πtj/n)]y_t = a_0 + \sum_{j=1}^{\lfloor n/2 \rfloor} [a_j \cos(2\pi t j/n) + b_j \sin(2\pi t j/n)]

for t=1,,nt=1,\dots,n and coefficients aja_j and bjb_j. \lfloor \rfloor is the greatest integer function (also called the “floor”), which rounds numbers down to the nearest integer. If nn is even, we have an/2cos(2πt12)=an/2(1)ta_{n/2} \cos(2\pi t \frac{1}{2})=a_{n/2}(-1)^t and bn/2=0b_{n/2}=0.

Here the values of jj correspond to frequencies indices. Each jj represents a different frequency component in the decomposition. j/nj/n is the frequency in cycles per sample. As jj goes from 1 to n/2\lfloor n/2 \rfloor, we sweep up through all distinguishable frequencies from the slowest oscillation up to the Nyquist frequency. For example, let’s say we have n=100n=100 data points:

We can now use regression to get the coefficients:

aj=2nt=1nxtcos(2πtj/n)a_j = \frac{2}{n}\sum_{t=1}^n x_t \cos(2\pi t j/n) and bj=2nt=1nxtsin(2πtj/n)b_j = \frac{2}{n}\sum_{t=1}^n x_t \sin(2\pi t j/n)

Here aja_j and bjb_j represent how much of a particular frequency is present in our signal, with aja_j and bjb_j together controlling the amplitude and phase at frequency jj. These are free parameters and set independently, but jointly contribute to AA and ϕ\phi.

From this, we can then define the scaled periodogram:

P(j/n)=aj2+bj2P(j/n) = a_j^2+b_j^2

for j/n0,1/2j/n \neq 0, 1/2. The scaled periodogram is the sample variance at each frequency component and is an estimate of σj2\sigma_j^2 corresponding to a sinusoid at frequency fj=j/nf_j = j/n. These frequencies are called the Fourier frequencies. Large values of P(j/n)P(j/n) indicate which frequencies dominate the series, small values may represent noise.

Next time we will relate this to the Discrete Fourier Transform (DFT) of a signal.