# Cross Spectrum (Complex) (G Dataflow)

Version:

Computes the cross power spectrum of the signals.

## signal x

The first input sequence.

This input accepts the following data types:

• 1D array of double-precision, floating-point numbers.
• 1D array of complex double-precision, floating-point numbers.

## signal y

The second input sequence.

This input accepts the following data types:

• 1D array of double-precision, floating-point numbers.
• 1D array of complex double-precision, floating-point numbers.

## 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

## error in

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

Default: No error

## cross spectrum

The cross power spectrum of the input sequences.

## 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 Cross Power Spectrum

The cross power, ${S}_{xy}\left(f\right)$, of the signals x(t) and y(t) is defined as

${S}_{xy}\left(f\right)=X*\left(f\right)Y\left(f\right)$

where

• X*(f) is the complex conjugate of X(f)
• X(f)=F{x(t)}
• Y(f)=F{y(t)}

This node uses the FFT or DFT routine to compute the cross power spectrum, which is given by

${S}_{xy}=\frac{1}{{n}^{2}}F*\left\{X\right\}F\left\{Y\right\}$

where Sxy represents the complex sequence cross spectrum and n is the number of samples that can accommodate input sequences signal x and signal y.

The largest cross power that this node can compute by the FFT is 223 (8,388,608 or 8M).

Note

Some textbooks define the cross power spectrum as ${S\prime }_{xy}\left(f\right)=X\left(f\right)Y*\left(f\right)$. If you prefer this definition of cross power to the one specified in this node, take the complex conjugate of the output sequence cross spectrum, because this node operates on the real and imaginary portions separately.

## How the Number of Samples Affects this Node

When the number of samples in the inputs signal x and signal y are equal and are a valid power of 2, such that $n=m={2}^{k}$ for k = 1, 2, 3,..., 23, this node makes direct calls to the FFT routine to compute the complex cross power sequence. This technique is efficient in both execution time and memory management because this node performs the operations in place.

When the number of samples in the inputs signal x and signal y are not equal, this node first resizes the smaller sequence by padding it with zeros to match the size of the larger sequence. If this size is a valid power of 2, such that $\mathrm{max}\left(n,m\right)={2}^{k}$ for k = 1, 2, 3,..., 23, this node computes the cross power spectrum using the FFT. Otherwise, this node uses the slower DFT to compute the cross power spectrum. Thus, the size of the complex output sequence is defined by $\text{size}=\mathrm{max}\left(n,m\right)$.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported