Skip to Main Content Skip to Search
Product Documentation

periodogram - PSD using periodogram

Syntax

[Pxx,w] = periodogram(x)
[Pxx,w] = periodogram(x,window)
[Pxx,w] = periodogram(x,window,nfft)
[Pxx,w] = periodogram(x,window,w)
[Pxx,f] = periodogram(x,window,nfft,fs)
[Pxx,f] = periodogram(x,window,f,fs)
[Pxx,f] = periodogram(x,window,nfft,fs,'range')
[Pxx,w] = periodogram(x,window,nfft,'range')
periodogram(...)

Description

[Pxx,w] = periodogram(x) returns the power spectral density (PSD) estimate Pxx of the sequence x using a periodogram. The power spectral density is calculated in units of power per radians per sample. The corresponding vector of frequencies w is computed in radians per sample, and has the same length as Pxx.

A real-valued input vector x produces a full power one-sided (in frequency) PSD (by default), while a complex-valued x produces a two-sided PSD.

In general, the length N of the FFT and the values of the input x determine the length of Pxx and the range of the corresponding normalized frequencies. For this syntax, the (default) length N of the FFT is the larger of 256 and the next power of 2 greater than the length of x. The following table indicates the length of Pxx and the range of the corresponding normalized frequencies for this syntax.

PSD Vector Characteristics for an FFT Length of N (Default)

Real/Complex Input Data

Length of Pxx

Range of the Corresponding Normalized Frequencies

Real-valued

(N/2) +1

[0, π]

Complex-valued

N

[0, 2π)

[Pxx,w] = periodogram(x,window) returns the PSD estimate Pxx computed using the modified periodogram method. The vector window specifies the coefficients of the window used in computing a modified periodogram of the input signal. Both input arguments must be vectors of the same length. When you don't supply the second argument window, or set it to the empty vector [], a rectangular window (rectwin) is used by default. In this case the standard periodogram is calculated.

[Pxx,w] = periodogram(x,window,nfft) uses the modified periodogram to estimate the PSD while specifying the length of the FFT with the integer nfft. If you set nfft to the empty vector [], it takes the default value for N listed in the previous syntax.

The length of Pxx and the frequency range for w depend on nfft and the values of the input x. The following table indicates the length of Pxx and the frequency range for w for this syntax.

PSD and Frequency Vector Characteristics

Real/Complex Input Datanfft Even/Odd Length of PxxRange of w

Real-valued

Even

(nfft/2 + 1)

[0, π]

Real-valued

Odd

(nfft + 1)/2

[0, π)

Complex-valued

Even or odd

nfft

[0, 2π)

[Pxx,w] = periodogram(x,window,w) estimates the two-sided PSD at the normalized frequencies specified in the vector w using the Goertzel algorithm. The frequencies of w are rounded to the nearest DFT bin commensurate with the resolution of the signal. The units of w are rad/sample.

[Pxx,f] = periodogram(x,window,nfft,fs) uses the sampling frequency fs specified as an integer in hertz (Hz) to compute the PSD vector (Pxx) and the corresponding vector of frequencies (f). In this case, the units for the frequency vector are in Hz. The spectral density produced is calculated in units of power per Hz. If you specify fs as the empty vector [], the sampling frequency defaults to 1 Hz.

The frequency range for f depends on nfft, fs, and the values of the input x. The length of Pxx is the same as in the table above. The following table indicates the frequency range for f for this syntax.

PSD and Frequency Vector Characteristics with fs Specified

Real/Complex Input Data

nfft Even/Odd

Range of f

Real-valued

Even

[0,fs/2]

Real-valued

Odd

[0,fs/2)

Complex-valued

Even or odd

[0,fs)

[Pxx,f] = periodogram(x,window,f,fs) uses the vector of frequencies f at which the PSD is estimated. The frequencies of f are rounded to the nearest DFT bin commensurate with the resolution of the signal.

[Pxx,f] = periodogram(x,window,nfft,fs,'range') or

[Pxx,w] = periodogram(x,window,nfft,'range') specifies the range of frequency values to include in f or w. This syntax is useful when x is real. 'range' can be either:

periodogram(...) with no outputs plots the power spectral density in dB per unit frequency in the current figure window. The frequency range on the plot is the same as the range of output w (or f) for the syntax you use.

Examples

Compute the periodogram of a 200 Hz signal embedded in additive noise using the default window:

Fs = 1000;   
t = 0:1/Fs:.3;
x = cos(2*pi*t*200)+0.1*randn(size(t)); 
periodogram(x,[],'onesided',512,Fs) 

Algorithms

The periodogram for a sequence [x1, ... , xN] is given by the following formula:

where is in units of radians/sample.

If you define the frequency variable in Hz, the periodogram is defined as:

where Fs is the sampling frequency.

The periodogram is an estimate of the PSD of the signal defined by the sequence [x1, ... , xN].

If you weight your signal sequence by a window [w1, ... , wN], then the weighted or modified periodogram is defined as:

Canceling the common factors and denoting the squared norm of the window sequence by , the modified periodogram can be simplified as:

In either case, periodogram uses an nfft-point FFT to compute the power spectral density.

References

[1] Stoica, P., and R.L. Moses, Introduction to Spectral Analysis, Prentice-Hall, 1997, pp. 24-26.

[2] Welch, P.D, "The Use of Fast Fourier Transform for the Estimation of Power Spectra: A Method Based on Time Averaging Over Short, Modified Periodograms," IEEE Trans. Audio Electroacoustics, Vol. AU-15 (June 1967), pp.70-73.

[3] Oppenheim, A.V., and R.W. Schafer, Discrete-Time Signal Processing, Prentice-Hall, 1989, pp.730-742.

See Also

dspdata.msspectrum | pburg | pcov | peig | pmcov | pmtm | pmusic | pwelch | pyulear | spectrum.periodogram

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS