GG313 Lecture 24
11/17/05
Power Spectrum,
Phase Spectrum,
and Aliasing
The primary display used in the frequency display iscommonly called the Power SpectrumIt is a plot thatshows a measure of the power in each frequency interval,where power is defined as the square of the amplitude.Power is calculated from the Fourier coefficients.
Recall:
(5.102)
The Power in y at frequency j is just Ak2=aj2+ bj2. Thus wecan generate a plot of power vs. frequency by plotting  Ak2vs frequency.
While this plot is strictly a “periodogram”, most people call itpower spectrum. A “real” power spectrum is defined asthe Fourier transform of the autocorrelation function.
Examples of power spectra:
05-3-05
Fig.5. Seismic noise spectra from the borehole seismometers at JT-1. Z and H1,H2 denote the noise spectraestimated from the vertical component and the horizontal components respectively. HNM and LHN indicatetypical noise spectra from the land observatories. The noise spectra at JT-1 show that JT-1 can provide goodquality data. NOISE SPECTRA FROM A BOREHOLE SEISMOMETER IN THE NW PACIFIC OCEAN.
Time Domain
Frequency Domain
Bottle-nosedolphin sound
Radio_Spectrum-03
This is a sample of the Radio Spectrum. Each peak is thelocation of a broadcast station. The frequency is inMegaHz.
De-meaned_spectra_compare
Spectrograms
Each verticalline is a powerspectrum.Colorsrepresentdifferent power.
We can also think of the power spectrum as yielding whichfrequencies contribute most to the variance of the signal.The larger the amplitude, the higher the variance. In fact,the variance is shown to be:
(5.109)
In practice, the periodogram is not a very stable plot - smallchanges in the signal can lead to large changes in individualspectral estimates (Aj). To get around this, we often averageseveral spectral estimates together to smooth the spectrumor we average several spectra to reduce the variance of eachspectral estimate. More about this when we discuss filters.
While the power spectrum and spectrogram (for non-stationary time series) are probably the most commonforms of display in the frequency domain, one can also plotthe phase spectrum, where the phase angle is given by:
(5.104)
The phase spectrum is important when determining the effectof a filter on a time series - to be discussed later.
One critical aspect of spectral analysis occurs when acritical assumption is violated. This assumption is that allenergy occurs at frequencies below the Nyquist frequency.When this is not the case, ALIASING occurs. Aliasing canbe a “feature” or a big problem.
The critical fact is that energy at frequencies above theNyquist doesn’t disappear, it gets shifted to frequenciesbelow the nyquist.
The demonstration below illustrates several points:  theconnection of spectral analysis to music (middle-C is261.63 Hz), what an “octave” is, how good your ear is atspectral analysis (which implies strongly that spectralanalysis is important for your survival), and the effects ofaliasing.
Aliasing Demo
Middle-C is 261.63 Hz
523
1046
2093
4186
60 Hz
Can you detect any distortion?
Picture 1
It’s easy to see from the figure above that aliasing moves highfrequencies to lower frequencies because samples are nottaken often enough.  Can we predict what frequency thealiased energy will show up at?
At the nyquist frequency  (Nyq=1/2t) there are twosamples per cycle. This is just enough to get an accuraterepresentation.
At twice the nyquist (2 Nyq=1/ t , the sampling frequency),there is one sample per cycle, and the resulting signal haszero frequency.
At 3Nyq, we’re back up to the Nyquist again.
Can you think of any reason why you might want to alias asignal?  In radio, you might want to take a signal and move itup to the frequency of the station, and then re-sample it at amuch lower frequency in the receiver after radio transmissionto recover the original signal.
In most cases, aliasing is BAD. Your desired signal iscorrupted with energy aliased from frequencies beyond theNyquist, and, once there, you cannot get rid of it.
How can you prevent aliasing?
• sample at a high enough frequency to cover all energy
or
• filter your data before sampling so that it contains onlyenergy below the nyquist. Such a filter is known as ananti-aliasing filter.
The continuous spectrum
The periodogram gives estimates of the energy atdiscrete frequencies, but it is just an estimate basedon some sample of the population. If we took manysamples we would find that the uncerrtainty of thespectral estimates was equal to about the estimateitself.
There are two ways to reduce this uncertainty:
1)Increase the length of the time series. This leads tomore spectral estimates within the same Nyquist, soyou can average adjacent estimates to improve thevariance.
2)Average the spectral estimates from several samplesof equal length and T.
Transform pairs:
When going from the time domain to the frequencydomain and back there are several transform pairsthat are worth remembering. These are specifictime domain signals that have characteristicfrequency domain transforms.
Each provides insight to a property of thetransformation. The transformations work bothways, and which side is the time domain andwhich is the frequency domain is not important.
Notice in these transforms how the spacingchanges from one domain to the other - a “t” in onedomain becomes a “1/t” in the other.
This representation in the frequency domain is somewhatdifferent than what we’ve used before. Now we haveNEGATIVE FREQUENCIES. A negative frequency is easyto interpret - it’s a rotation (like the wagon wheel) that goesin the opposite direction of the true motion. Right now,it’s aconvenience for presenting some characteristics of thetransforms.
DELTA FUNCTION: A delta function in this case is a singlenon-zero point in a long line of zeroes. Note that it’stransform has equal energy in all frequencies.
EXERCISE:  Generate a 64-point time series of zeroes, witha 1 at point 32. Take its fft. What do you get? Change the 1to a 2. How does this change the fft? How do the values ofthe spectral estimates relate to the size of the deltafunction?
Using Matlab’s fft function, you get complex values for thespectral estimates. To change them to power spectralestimates multiply each estimate by its complex conjugate:
P=Y.*conj(Y), where y=fft(data)
and then plot P.
What happens if you move the impulse to any other point?
Nothing changes?
How about the phase spectrum?
You can get the phase response by doing
phase=angle(Y);
Try plotting that with the impulse in different locations.
BOXCAR:
Use the same 64-point zeros function, but replace points 5-9 with ones. { y(5:9)=[1 1 1 1 1] } and calculate the powerspectrum.
Does it look like the boxcar transform I showed?  Why not?
How does the maximum power relate to the size of theboxcar?
Would this power spectrum change if the number of pointswas increased to 128?
What would happen if all values were 1?
Then you would only get the DC (zero frequency) term.
What if only one value were 1 ?
This shows the reciprocity of the transform. It doesn’t matterwhich is the time domain or which is the frequency domain.
Note with the boxcar that the first zero crossing occurs at afrequency of 1/d where d is the width of the boxcar.