Owning Class: spectral analysis
Requires: MathScript RT Module
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
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.
| 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.
|
| 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. |
This function uses the Welch method to compute the cross power spectral density of x and y.
This function is supported in the LabVIEW Run-Time Engine only if you request an output from the function. This function can remain in your scripts when you build a stand-alone application or shared library, but if you do not request an output, the LabVIEW Run-Time Engine does not execute this function. If you request an output, the LabVIEW Run-Time Engine executes this function as normal.
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);
coherence_ms
psd_burg
psd_covar
psd_mcovar
psd_periodogram
psd_welch
psd_yule
pspec_eign
pspec_music
tf_estimateplot