From 12:00 PM - 4:00 PM CST on Thursday, October 18, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

# Cross Spectrum (Mag-Phase » Single-shot) (G Dataflow)

Version:

Computes the single-sided, scaled, cross power spectrum of two real-time signals.

## signal x

The input, time-domain signal x, usually in volts. The time-domain record must contain at least three cycles of the signal for a valid estimate.

## signal y

The input, time-domain signal y, usually in volts. The time-domain record must contain at least three cycles of the signal for a valid estimate.

## error in

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

Default: No error

## dt

The sample period of the time-domain signal, usually in seconds.

Set this input to 1/fs, where fs is the sampling frequency of the time-domain signal.

Default: 1

## magnitude

The single-sided cross power spectrum between the input signals x and y.

## phase

The phase spectrum, in radians, showing the difference between the phases of the input signals x and y.

## error out

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

## df

The frequency interval of the power spectrum. The unit of this output is Hz if the sample period is in seconds.

## Algorithm for Calculating the Single-Sided Cross Power Spectrum

If the input signals signal x and signal y have different lengths, this node first pads the end of the shorter input signal with zeros to make the signals the same length. This node then uses the following equation to compute the two-sided cross power spectrum:

$\frac{\text{FFT}\left(\text{signal x}\right)×\left(\text{FFT}\right)*\left(\text{signal y}\right)}{{N}^{2}}$

where N is the common length of the two input signals after the node pads the end of the shorter input signal with zeros.

To compute the single-sided cross power spectrum, this node converts the two-sided cross power spectrum to the single-sided form.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported