<< Chapter < Page | Chapter >> Page > |
In implementing
[link] , some approximations
are used. First, the sum cannot be calculated over an infinitetime horizon, and the variable
over
replaces the sum
with
.
Each pass through the
for
loop calculates one point of
the smoothed curve
wsmooth
using the M
atlab function
interpsinc.m
, which is shown below.
The value of the sinc is calculated at each timeusing the function
srrc.m
with the appropriate offset
tau
, and then the convolution
is performed by the
conv
command.
This code is slow and unoptimized. A clever programmerwill see that there is no need to calculate the
sinc for every point, and efficient implementationsuse sophisticated look-up tables to avoid the calculation of
transcendental functions completely.
function y=interpsinc(x, t, l, beta)
x = sampled data
t = place at which value desired l = one sided length of data to interpolate
beta = rolloff factor for srrc function = 0 is a sinc
if nargin==3, beta=0; end; % if unspecified, beta is 0tnow=round(t); % create indices tnow=integer part
tau=t-round(t); % plus tau=fractional parts_tau=srrc(l,beta,1,tau); % interpolating sinc at offset tau
x_tau=conv(x(tnow-l:tnow+l),s_tau); % interpolate the signaly=x_tau(2*l+1); % the new sample
interpsinc.m
interpolate to find a single point using the direct method
(download file)
While the indexing needed in
interpsinc.m
is a bit tricky,
the basic idea is not: the sinc interpolation of
[link] is
just a linear filter with impulse response
. (Remember, convolutions are the hallmark
of linear filters.) Thus, it is a lowpass filter, since thefrequency response is a rect function. The delay
is proportional to the phase of the frequency response.
In
sininterp.m
, what happens when the sampling rate is too
low? How large can the sampling interval
Ts
be?
How high can the frequency
f
be?
In
sininterp.m
, what happens when the window
is reduced? Make
over
smaller and find out. What happens when too few points are
interpolated? Make
intfac
smaller and find out.
Create a more interesting (more complex) wave . Answer the above questions for this .
Let
be a sum of five sinusoids for
between
and 10 seconds. Let
represent samples of
with
.
Use
interpsinc.m
to interpolate the values
,
, and
.
Compare the interpolated values to the actual values.Explain any discrepancies.
Observe that sinc
dies away (slowly) in time at a rate
proportional to
. This is one of the reasons that
so many terms are used in the convolution(i.e., why the variable
over
is large).
A simple way to reduce the number of terms is to use a functionthat dies away more quickly than the sinc;
a common choice is the
square-root raised cosine (SRRC) function, which plays an important role in
pulse shaping in Chapter
[link] .
The functional form of the SRRC is given inEquation
[link] .
The SRRC can easily be incorporated into the interpolationcode by replacing the code
interpsinc(w,tnow(i),over)
with
interpsinc(w,tnow(i),over,beta)
.
Notification Switch
Would you like to follow the 'Software receiver design' conversation and receive update notifications?