# pwelch

Welch’s power spectral density estimate

## Syntax

## Description

returns
the power spectral density (PSD) estimate, `pxx`

= pwelch(`x`

)`pxx`

,
of the input signal, `x`

, found using Welch's overlapped
segment averaging estimator. When `x`

is a vector,
it is treated as a single channel. When `x`

is
a matrix, the PSD is computed independently for each column and stored
in the corresponding column of `pxx`

. If `x`

is
real-valued, `pxx`

is a one-sided PSD estimate.
If `x`

is complex-valued, `pxx`

is
a two-sided PSD estimate. By default, `x`

is divided
into the longest possible segments to obtain as close to but not exceed
8 segments with 50% overlap. Each segment is windowed with a Hamming
window. The modified periodograms are averaged to obtain the PSD estimate.
If you cannot divide the length of `x`

exactly
into an integer number of segments with 50% overlap, `x`

is
truncated accordingly.

uses
the input vector or integer, `pxx`

= pwelch(`x`

,`window`

)`window`

, to divide
the signal into segments. If `window`

is a vector, `pwelch`

divides
the signal into segments equal in length to the length of `window`

.
The modified periodograms are computed using the signal segments multiplied
by the vector, `window`

. If `window`

is
an integer, the signal is divided into segments of length `window`

.
The modified periodograms are computed using a Hamming window of length `window`

.

uses `pxx`

= pwelch(`x`

,`window`

,`noverlap`

) `noverlap`

samples
of overlap from segment to segment. `noverlap`

must
be a positive integer smaller than `window`

if `window`

is
an integer. `noverlap`

must be a positive integer
less than the length of `window`

if `window`

is
a vector. If you do not specify `noverlap`

, or
specify `noverlap`

as empty, the default number
of overlapped samples is 50% of the window length.

`[`

returns a frequency vector, `pxx`

,`f`

] = pwelch(___,`fs`

)`f`

, in cycles per unit time. The
sample rate, `fs`

, is the number of samples per unit time. If
the unit of time is seconds, then `f`

is in cycles/sec (Hz).
For real–valued signals, `f`

spans the interval
[0,`fs`

/2] when `nfft`

is even and
[0,`fs`

/2) when `nfft`

is odd. For
complex-valued signals, `f`

spans the interval
[0,`fs`

). `fs`

must be the fifth input
to `pwelch`

. To input a sample rate and still use the default
values of the preceding optional arguments, specify these arguments as empty,
`[]`

.

`[`

returns the two-sided Welch PSD estimates at the frequencies specified in the
vector, `pxx`

,`f`

] = pwelch(`x`

,`window`

,`noverlap`

,`f`

,`fs`

)`f`

. The vector `f`

must contain
at least two elements, because otherwise the function interprets it as
`nfft`

. The frequencies in `f`

are in
cycles per unit time. The sample rate, `fs`

, is the number of
samples per unit time. If the unit of time is seconds, then
`f`

is in cycles/sec (Hz).

`[___,`

returns
the `pxxc`

] = pwelch(___,'ConfidenceLevel',`probability`

)`probability`

× 100%
confidence intervals for the PSD estimate in `pxxc`

.

`[___] = pwelch(___,`

returns the PSD estimate if `spectrumtype`

)`spectrumtype`

is specified as
`'psd'`

and returns the power spectrum if
`spectrumtype`

is specified as
`'power'`

.

`pwelch(___)`

with no output
arguments plots the Welch PSD estimate in the current figure window.

## Examples

## Input Arguments

## Output Arguments

## More About

## References

[1] Hayes, Monson H.
*Statistical Digital Signal Processing and Modeling*. New York:
John Wiley & Sons, 1996.

[2] Stoica, Petre, and Randolph
Moses. *Spectral Analysis of Signals.* Upper Saddle River, NJ:
Prentice Hall, 2005.

## Extended Capabilities

**Introduced before R2006a**