Axes.
psd
(x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None, return_line=None, **kwargs)¶Plot the power spectral density.
Call signature:
psd(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window=mlab.window_hanning, noverlap=0, pad_to=None,
sides='default', scale_by_freq=None, return_line=None, **kwargs)
The power spectral density by Welch’s average periodogram method. The vector x is divided into NFFT length segments. Each segment is detrended by function detrend and windowed by function window. noverlap gives the length of the overlap between segments. The of each segment are averaged to compute , with a scaling to correct for power loss due to windowing.
If len(x) < NFFT, it will be zero padded to NFFT.
Parameters: | x : 1-D array or sequence
Fs : scalar
window : callable or ndarray
sides : [ ‘default’ | ‘onesided’ | ‘twosided’ ]
pad_to : integer
NFFT : integer
detrend : {‘default’, ‘constant’, ‘mean’, ‘linear’, ‘none’} or callable
scale_by_freq : boolean, optional
noverlap : integer
Fc : integer
return_line : bool
**kwargs :
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns: | Pxx : 1-D array
freqs : 1-D array
line : a
|
See also
specgram()
specgram()
differs in the default overlap; in not returning the mean of the segment periodograms; in returning the times of the segments; and in plotting a colormap instead of a line.magnitude_spectrum()
magnitude_spectrum()
plots the magnitude spectrum.csd()
csd()
plots the spectral density between two signals.
Notes
For plotting, the power is plotted as for decibels, though Pxx itself is returned.
References
Bendat & Piersol – Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986)
Examples
(Source code, png, pdf)