Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

psd_periodogram (MathScript RT Module Function)

LabVIEW 2010 Help

Edition Date: June 2010

Part Number: 371361G-01

»View Product Info

Owning Class: spectral analysis

Requires: MathScript RT Module

Syntax

psd_periodogram(x)

psd_periodogram(x, win)

psd_periodogram(x, win, fftsize)

psd_periodogram(x, win, fftsize, fs)

psd_periodogram(x, win, fftsize, range)

psd_periodogram(x, win, fftsize, fs, range)

Pxx = psd_periodogram(x)

Pxx = psd_periodogram(x, win)

Pxx = psd_periodogram(x, win, fftsize)

Pxx = psd_periodogram(x, win, fftsize, fs)

Pxx = psd_periodogram(x, win, fftsize, range)

Pxx = psd_periodogram(x, win, fftsize, fs, range)

[Pxx, w] = psd_periodogram(x)

[Pxx, w] = psd_periodogram(x, win)

[Pxx, w] = psd_periodogram(x, win, fftsize)

[Pxx, w] = psd_periodogram(x, win, fftsize, range)

[Pxx, f] = psd_periodogram(x, win, fftsize, fs)

[Pxx, f] = psd_periodogram(x, win, fftsize, fs, range)

Legacy Name: periodogram

Description

Uses the periodogram method to calculate the power spectral density of the input signal. If you do not request an output, this function plots the power spectral density in the current plot window.

Details

Examples

Inputs

Name Description
x Specifies the input signal sequence. x is a real or complex vector.
win Specifies the window to apply to x. length(win) must equal length(x). The default is a rectangular window with a length that equals the length of x.
fftsize Specifies the length of the FFT to perform on the data. The default is the next power of 2 greater than the length of x if this number is greater than 256. Otherwise, the default is 256.
fs Specifies the sampling frequency of the input sequence in Hz. If you specify fs, LabVIEW returns the output frequencies in Hz. Otherwise, LabVIEW returns the output frequencies in radians per sample.
range Specifies the range of the power spectral density. range is a string that accepts the following values.

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

Outputs

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

Details

This function uses the periodogram method to calculate the power spectral density of x. LabVIEW uses the following equation to calculate the power spectral density:

Pxx = (1 / U)|fft(w.*x)|^2

where w is the window LabVIEW applies to the signal, and U equals sum(w.^2) / length(w).

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.

Examples

fs = 1000;
t = 0:1/fs:0.2;
fftsize = 1024;
win = win_hamming(length(t));
noise = randnormal(size(t));
x = sin(2*pi*100*t) + cos(2*pi*250*t) + noise;
Pxx = psd_periodogram(x, win, fftsize, fs);

Related Topics

psd_burg
psd_covar
psd_mcovar
psd_welch
psd_yule
pspec_eign
pspec_music


 

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