Unevenly Sampled Signal Spectrum (G Dataflow)

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.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

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.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Algorithm for Calculating the Power Spectrum Using the Lomb Normalized Periodogram

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

Web Server: Not supported in VIs that run in a web application