# Unevenly Sampled Signal Spectrum (G Dataflow)

Version:

Calculates the power spectrum of a signal that is unevenly spaced in time.

## x

The data material at the discrete- and unevenly-spaced times.

## x time

The discrete- and unevenly-spaced times.

## error in

Error conditions that occur before this node runs. The node responds to this input according to standard error behavior.

Default: No error

## power spectrum

The power spectrum, in the sense of the Lomb normalized periodogram.

## power spectrum frequency

The frequency points at which this node calculates the power spectrum.

## error out

Error information. The node produces this output according to standard error behavior.

## Using the Lomb Normalized Periodogram to Calculate the Power Spectrum

Given the data xk at the time points tk, the following equations define the data material x and the discrete- and unevenly-spaced times x time:

$x=\left\{{x}_{0},{x}_{1},...,{x}_{n-1}\right\}$

and

$\text{x times}=\left\{{t}_{0},{t}_{1},...,{t}_{n-1}\right\}$

Furthermore,

$\stackrel{¯}{x}=\frac{1}{n}\underset{k=0}{\overset{n-1}{\sum }}{x}_{k}$

and

${\sigma }^{2}=\frac{1}{n-1}\underset{k=0}{\overset{n-1}{\sum }}{\left({x}_{k}-\stackrel{¯}{x}\right)}^{2}$

Then the Lomb normalized periodogram is defined by the following equation:

$p\left(\omega \right)=\frac{1}{2{\sigma }^{2}}\left(\frac{{\left[\underset{k=0}{\overset{n-1}{\sum }}\left({x}_{k}-\stackrel{¯}{x}\right)\mathrm{cos}\omega \left({t}_{k}-\tau \right)\right]}^{2}}{\underset{k=0}{\overset{n-1}{\sum }}{\mathrm{cos}}^{2}\omega \left({t}_{k}-\tau \right)}+\frac{{\left[\underset{k=0}{\overset{n-1}{\sum }}\left({x}_{k}-\stackrel{¯}{x}\right)\mathrm{sin}\omega \left({t}_{k}-\tau \right)\right]}^{2}}{\underset{k=0}{\overset{n-1}{\sum }}{\mathrm{sin}}^{2}\omega \left({t}_{k}-\tau \right)}\right)$

with

$\tau =\frac{1}{2\omega }\mathrm{arctan}\left(\frac{\underset{k=0}{\overset{n-1}{\sum }}\mathrm{sin}2\omega {t}_{k}}{\underset{k=0}{\overset{n-1}{\sum }}\mathrm{cos}2\omega {t}_{k}}\right)$

The following diagram shows the spectrum of length 256 of a signal that has been sampled at unequal intervals of time. The signal is a combination of sine waves of frequencies 20, 40, 60, and 80 Hz. The duration of the signal is 1 sec. The sampling frequency was chosen as 256 Hz, giving the frequency resolution of 1 Hz.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported