psd_periodogram (MathScript RT Module Function)

LabVIEW 2012 MathScript RT模块帮助

»查看产品信息 下载帮助（仅限Windows）

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).

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_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);

﻿