<< Chapter < Page | Chapter >> Page > |
Use your
Pgram
function
to estimate the power spectrumof
$y\left(n\right)$ ,
${P}_{yy}\left({\omega}_{k}\right)$ .
Plot
${P}_{yy}\left({\omega}_{k}\right)$ vs.
${\omega}_{k}$ .
Next, estimate the power spectrum of $y$ , ${P}_{yy}\left({\omega}_{k}\right)$ using $1/4$ of the samples of $y$ . Do this only using samples ${y}_{0}$ , ${y}_{1}$ , $\cdots $ , ${y}_{255}$ . Plot ${P}_{yy}\left({\omega}_{k}\right)$ vs. ${\omega}_{k}$ .
Pgram
code.The periodogram is a simple method, but it does not yield very good results.To get a better estimate of the power spectrum, we will introduce Bartlett's method, also known as the averaged periodogram . This method has three steps. Suppose we have a length-N sequence $x\left(n\right)$ .
Write a Matlab function called
AvPgram
to calculate
the averaged periodogram, using the above steps.The syntax for this function should be
[P,w] = AvPgram(x, K)
where
$x$ is a discrete random sequence of length
$N$ and
the
$K$ is the number of nonoverlapping segments. The
outputs of this command are
$P$ , the samples of the averaged periodogram,
and
$w$ , the corresponding frequencies of the samples. Both
$P$ and
$w$ should be vectors of length M where N=KM.
You may use your
Pgram
function.
A=reshape(x,M,K)
will orient length
$M$ segments of the vector
$x$ into
$K$ columns of the matrix
$A$ .Use your Matlab function
AvPgram
to estimate the power
spectrum of
$y\left(n\right)$ which was generated in the previous section.
Use all 1024 samples of
$y\left(n\right)$ , and let
$K=16$ . Plot
$P$ vs.
$w$ .
AvPgram
code.Consider a linear time-invariant system with frequency response $H\left({e}^{j\omega}\right)$ , where ${S}_{xx}\left(\omega \right)$ is the power spectrum of the input signal, and ${S}_{yy}\left(\omega \right)$ is the power spectrum of the output signal.It can be shown that these quantities are related by
In the "Periodogram" section, the sequence $y\left(n\right)$ was generated byfiltering an i.i.d. Gaussian (mean=0, variance=1) sequence $x\left(n\right)$ , using the filter in [link] . By hand, calculate the power spectrum ${S}_{xx}\left(\omega \right)$ of $x\left(n\right)$ , the frequency response of the filter, $H\left({e}^{j\omega}\right)$ , and the power spectrum ${S}_{yy}\left(\omega \right)$ of $y\left(n\right)$ .
Download the file speech.au for this section. For help on the following Matlab topics select the corresponding link: how to load and play audio signals and specgram function .
The methods used in the last two sections can only be applied to stationary random processes. However, most signals in nature are not stationary. For a nonstationary random process,one way to analyze it is to subdivide the signal into segments (which may be overlapping)and treat each segment as a stationary process. Then we can calculate the power spectrum of each segment. This yieldswhat we call a spectrogram .
While it is debatable whether or not a speech signal is actually random,
in many applications it is necessary to model it as being so.In this section, you are going to use the Matlab command
specgram
to calculate the spectrogram of a speech signal. Read the help for the
specgram function .
Find out what the command does, and how to calculate and draw aspectrogram.
Draw the spectrogram of the speech signal in
speech.au .
When using the
specgram
command with no output arguments,
the absolute value of the spectrogram will be plotted.Therefore you can use
speech=auread('speech.au');
to read the speech signal and use
specgram(speech);
to draw the spectrogram.
Notification Switch
Would you like to follow the 'Purdue digital signal processing labs (ece 438)' conversation and receive update notifications?