psd Function

public pure function psd(win, x, fs, nfft) result(rst)

Computes the power spectral density (PSD) of a signal via Welch's method.

References

  • 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 Transactions on Audio and Electroacoustics, AU-15 (2): 70-73, 1967.

  • Wikipedia - Welch's Method

Arguments

Type IntentOptional Attributes Name
class(window), intent(in) :: win

The window to apply. The size of the window must be non-zero and positive-valued.

real(kind=real64), intent(in) :: x(:)

The signal to transform.

real(kind=real64), intent(in), optional :: fs

An optional input, that if supplied, allows for normalization of the computed spectrum by the frequency resolution.

integer(kind=int32), intent(in), optional :: nfft

An optional input that can be used to force the length of each individual DFT operation by padding any remaining space with zeros. If not supplied, the window size is used to determine the size of the DFT.

Return Value real(kind=real64), allocatable, (:)

An array containing the discrete PSD estimate. The estimate is returned at discrete frequency intervals that can be determined by a call to frequency_bin_width.