<< Chapter < Page | Chapter >> Page > |
One way that the correlation might fail to find the correct location of the header is if the header string accidently occurredin the data values. If this happened, then the correlation would be as large at the “accidental” location as at the intendedlocation. This becomes increasingly unlikely as the header is made longer, though a longer header also wastes bandwidth.Another way to decrease the likelihood of false hits is to average over several headers.
Rerun
correx.m
with different length data vectors
(try
l=100
,
r=100
and
l=10
,
r=10
).
Observe how the location of the peak changes.
Rerun
correx.m
with different length headers.
Does the peak in the correlation become more or less distinct asthe number of terms in the header increases?
Rerun
correx.m
with different amounts of noise. Try
sd=0, .1, .3, .5, 1, 2
. How large can the noise
be made if the correlation is still to find the true location of the header?
The code in
corrvsconv.m
explores the relationship
between the correlation and convolution. The convolution of twosequences is essentially the same as the cross-correlation of the time-reversed
signal, except that the correlation is padded with extra zeroes.(The M
atlab function
fliplr
carries out the time reversal.)
If
h
is made longer than
x
, what needs to be
changed so that
yconv
and
ycorr
remain equal?
h=[1 -1 2 -2 3 -3]; % define sequence h[k]x=[1 2 3 4 5 6 -5 -4 -3 -2 -1]; % define sequence x[k]yconv=conv(x,h) % convolve x[k]*h[k]ycorr=xcorr(h,fliplr(x)) % correlation of flipped x and h
corrvsconv.m
comparing correlation and convolution
(download file)
Suppose that a message has been coded into its alphabet,
pulse shaped into an analog signal, and transmitted.The receiver must then “un–pulse-shape” the analog signal
back into the alphabet, which requires finding wherein the received signal the pulse shapes are located.
Correlation can be used to accomplishthis task, because it is effectively the task of locating
a known sequence (in this case the sampled pulse shape) within a longersequence (the sampled received signal). This is analogous to
the problem of finding the header within thereceived signal, although some of the details have changed.
While optimizing this procedure is somewhat involved (and istherefore postponed until Chapter
[link] ),
the gist of the method is reasonably straightforward,and is shown by continuing the example begun in
pulseshape.m
.
The code in
recfilt.m
below begins by repeating the
pulse shaping code from
pulseshape.m
,
using the pulse shape
ps
defined
in the top plot of
[link] .
This creates an “analog” signal
x
that is oversampled by a factor
.
The receiver begins by correlating the pulse shapewith the received signal, using the
xcorr
function.
Because of the connections between cross-correlation,
convolution, and filtering, this process is often called
pulse-matched filtering because the impulse response
of the filter is matched to the shape of the pulse. After appropriate scaling, this is downsampled to
the symbol rate by choosing one out of each
(regularly spaced) samples.
These values are then quantized to thenearest element of the alphabet using the function
quantalph
(which was introduced in
Exercise
[link] ).
The function
quantalph
has two vector arguments; the elements of the
first vector are quantized to the nearest elementsof the second vector
(in this case quantizing
z
to the nearest elements
of
).
Notification Switch
Would you like to follow the 'Software receiver design' conversation and receive update notifications?