# difference between a power spectrum and a power density spectrum

Started by June 25, 2005
```Hello!

A friend of mine asked me this question and before answering her, I
would like your opinion as well.

I have always calculated power spectra by multiplying the FFT signal by
the complex conjugate of the FFT signal (equivalent to real^2 + imag^2)
and dividing by the number of points.
What is the difference between a power spectrum and a power density
spectrum?
A method that people seem to use for calculation of the power density
spectrum is Welch's
non-parametric method. What does it involve and what are the
do?

Thanks

```
```The Matlab  Signal Processing toolbox help documentation has a good summary
describing the various spectral estimation functions.   Check out the topics
under "Statistical Signal Processing -> Spectral Analysis" at this link:

http://www.mathworks.com/access/helpdesk/help/toolbox/signal/

"tramoman" <tramoman@yahoo.it> wrote in message
> Hello!
>
> A friend of mine asked me this question and before answering her, I
> would like your opinion as well.
>
> I have always calculated power spectra by multiplying the FFT signal by
> the complex conjugate of the FFT signal (equivalent to real^2 + imag^2)
> and dividing by the number of points.
> What is the difference between a power spectrum and a power density
> spectrum?
> A method that people seem to use for calculation of the power density
> spectrum is Welch's
> non-parametric method. What does it involve and what are the
> advantages/disadvantages of this method? How does it differ to what I
> do?
>
> Thanks
>

```
```
tramoman wrote:
> Hello!
>
> A friend of mine asked me this question and before answering her, I
> would like your opinion as well.
>
> I have always calculated power spectra by multiplying the FFT signal by
> the complex conjugate of the FFT signal (equivalent to real^2 + imag^2)
> and dividing by the number of points.
> What is the difference between a power spectrum and a power density
> spectrum?
> A method that people seem to use for calculation of the power density
> spectrum is Welch's
> non-parametric method. What does it involve and what are the
> advantages/disadvantages of this method? How does it differ to what I
> do?

First, the power spectrum density (PSD) can be computed as the
squared magnitude of a properly scaled spectrum, divided by the
sampling period. This is known as the "periodogram".

What does "properly scaled DFT mean": To have Parseval's identity
work, the N point DFT must be scaled by a factor 1/sqrt(N). Some
implementations (matlab being one of them) skips this scale factor
to save a couple of computations, so the user needs to scale it
herself.

To check if your friend's implementation is properly scaled,
have her compute the sum of the squared magnitudes of both the
time domain signal and the corresponding frequency domain spectrum.
If the sums are equal, everything is OK. If not, find out what the
scale factor is (check in particular if the sum in frequency domain
is N times larger than the sum in time domain, N being the length
of the time domain signal). Below I assume that your friend uses
a "properly scaled" implementation of the FFT.

Second, the 1/dT factor is needed since we are talking about power.
In time domain, the *energy* of the signal x[n] is defined as

E= sum x[n]^2
n

and the power is defined as

P = E/T = E/(N*dT)

where T is the total duration of the (finite length) signal and
N and dT are the number of samples and the sample interval,
respectively.

Due to Parseval's identity we have

N-1          N-1
E = sum x[n]^2 = sum |X[k]|^2
n=0          k=0

where X[k] is the DFT of x[n], and so the PSD becomes

N-1
P = 1/(N*dT) sum |X[k]|^2.
k=0

Again, be aware that any additional scaling of the DFT
due to the implementation, comes in addition to all this!

The difference between a "power spectrum" and a "power density
spectrum" is basically a matter of habit/sloppiness. "Power
spectrum" is a day-to-day-use simplification of the prescise
(pedantic) term "power spectrum density".

Define the k'th coefficient of the periodogram as
(for simplicity disregarding the scaling factors as
discussed above)

P[k] = |X[k]|^2.

This is an estimator of the k'th coefficient of the PSD.

The problem is that the variance of this estimator is very
large,

Var{P[k]} = P[k]^2

i.e. the variance is on the order of the coefficient itself.
Nothing is gained by using more data points in the DFT, since
the factor N does not enter the expression of the variance.

So what one has to do, then, to reduce the variance, is to
average many coefficients P[k]. This can be done in several ways.
You can average coeffients that are nearby in the same spectrum,

Q
P'[k] = 1/(2Q+1) sum W[q]P[k-q]
q=-Q

This approach corresponds to multiplying the data sequence x[n]
by some time domain window function w[n].

The other method is to average the coefficients of several
independent power spectra.

A third method is to average several power spectra that
themselves have been computed from weghted data sequences.
Welch's method is based on this third approach.

The rationale is that the general (low resolution) spectral
shape should be estimated with as low variance as possible.

Rune

```