Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

crosspsd (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

Owning Class: spectral analysis

Requires: MathScript RT Module

Syntax

crosspsd(x, y)

crosspsd(x, y, win)

crosspsd(x, y, win, noverlap)

crosspsd(x, y, win, noverlap, fftsize)

crosspsd(x, y, win, noverlap, range)

crosspsd(x, y, win, noverlap, fftsize, fs)

crosspsd(x, y, win, noverlap, fftsize, range)

crosspsd(x, y, win, noverlap, fftsize, fs, range)

Cxy = crosspsd(x, y)

Cxy = crosspsd(x, y, win)

Cxy = crosspsd(x, y, win, noverlap)

Cxy = crosspsd(x, y, win, noverlap, fftsize)

Cxy = crosspsd(x, y, win, noverlap, range)

Cxy = crosspsd(x, y, win, noverlap, fftsize, fs)

Cxy = crosspsd(x, y, win, noverlap, fftsize, range)

Cxy = crosspsd(x, y, win, noverlap, fftsize, fs, range)

[Cxy, w] = crosspsd(x, y)

[Cxy, w] = crosspsd(x, y, win)

[Cxy, w] = crosspsd(x, y, win, noverlap)

[Cxy, w] = crosspsd(x, y, win, noverlap, fftsize)

[Cxy, w] = crosspsd(x, y, win, noverlap, range)

[Cxy, w] = crosspsd(x, y, win, noverlap, fftsize, range)

[Cxy, f] = crosspsd(x, y, win, noverlap, fftsize, fs)

[Cxy, f] = crosspsd(x, y, win, noverlap, fftsize, fs, range)

Legacy Name: cpsd

Description

Computes the cross power spectral density of two discrete time signals. If you do not request an output, this function plots the cross power spectral density in the current plot window.

Details

Examples

Inputs

Name Description
x Specifies the first input sequence. x is a real or complex vector.
y Specifies the second input sequence. y is a real or complex vector. length(x) must equal length(y).
win Specifies the window to apply to each segment of x and y. The length of win determines the number of segments into which LabVIEW divides x and y. win can be a vector that represents the window coefficients or an integer that represents a Hamming window with a length of win. The default is a Hamming window where LabVIEW divides x and y into eight sections.
noverlap Specifies the number of data elements that overlap between adjacent segments of data. noverlap must be less than the length of win. The default is the length that results in an overlap of half of the data elements between adjacent segments.
fftsize Specifies the length of the FFT to perform on each segment of the data. The default is the next power of 2 greater than the length of each segment of x and y if this number is greater than 256. Otherwise, the default is 256.
fs Specifies the sampling frequency of the input sequences in Hz. If you specify fs, LabVIEW returns the output frequencies in Hz. If you do not specify fs, LabVIEW returns the output frequencies in radians per sample.
range Specifies the range of the cross power spectral density. range is a string that accepts the following values.

'onesided' (default) LabVIEW returns the single-sided cross power spectral density.
'twosided' LabVIEW returns the double-sided cross power spectral density.

Outputs

Name Description
Cxy Returns the cross power spectral density of the two input signals x and y. If both x and y are real and range is 'onesided', the length of Cxy is fftsize/2 + 1 for an even fftsize and (fftsize + 1) / 2 for an odd fftsize. Otherwise, the length of Cxy is fftsize.
w Returns the frequencies in radians per sample at the points where LabVIEW evaluates Cxy.
f Returns the frequencies in Hz at the points where LabVIEW evaluates Cxy.

Details

This function uses the Welch method to compute the cross power spectral density of x and y.

The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes (if you request output)
Supported on RT targets Yes (if you request output)
Suitable for bounded execution times on RT Not characterized

Examples

fs = 1000;
t = 0:1/fs:0.2;
fftsize = 1024;
win = win_hann2(64);
noverlap = 32;
noise = randnormal(size(t));

x = sin(2*pi*100*t) + cos(2*pi*250*t) + noise;
y = 2*sin(2*pi*50*t) + 3*cos(2*pi*400*t) - noise;
Cxy = crosspsd(x, y, win, noverlap, fftsize, fs);

Related Topics

coherence_ms
psd_burg
psd_covar
psd_mcovar
psd_periodogram
psd_welch
psd_yule
pspec_eign
pspec_music
tf_estimateplot


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit