0
$\begingroup$

Suppose I'm transmitting two streams at the same time in blocks each of length $N$ samples each sample of duration $T_s$ seconds. Block $t$ of stream $i$ is $\mathbf{x}_i[t]=\left[x_{i,0}[t],\,\,\,x_{i,1}[t],\cdots,\,\,\,x_{i,N-1}[t]\right]^T$. The second stream is shifted by $\Delta\tau=LT_s+\epsilon T_s$ seconds, where $L$ is a nonnegative integer, and $\epsilon\in[0, 1)$. What's the best way to simulate this scenario?

My approach: I'm thinking of oversampling the second stream by a factor $M$, such that the oversampled period is $T_{\text{OS}}$ seconds, then I find how many oversampled periods I need to shift the second stream as $m=\lceil\frac{\Delta\tau}{T_{\text{OS}}}\rceil$, and append $m$ $0$s to the beginning of the first frame, and then downsample the resulting frame by a factor of $M$. Is this the correct way? Also, how can I handle the subsequent frames, given that in my simulation I generate and process the data streams in a block-by-block basis.

$\endgroup$

1 Answer 1

2
$\begingroup$

That's definitely a way to go about it!

As you identified, the integer shift $L$ is "easy". The harder part is the $\epsilon$ shift.

By the way, digital communication receivers need to do this kind of thing all the time; your receive signal almost never is perfectly aligned with your sampling instants to begin with.

Your "oversample - shift - downsample" approach is fine, but you must realize that it should (following your definition of what it's supposed to do) a LTI system. It can be represented as a single filter at your original sampling rate!

Enter stage left: fractional delay filters. The idea is very simple: you know that the time-continuous signal your samples represent can be reconstructed perfectly by converting each sample into a Dirac impulse (at the sample rate) and filtering that time-continuous impulse series with a perfect sinc-shaped filter. Your $\epsilon$-shifted instants are just the values you get from looking at the resulting time-continuous signal at a time-instant series that's $\epsilon$ shifted relative to your Dirac comb.

You can emulate the same by taking your perfect sinc, sampled at the same sampling rate, but not at it's maximum and all the zeros, but offset by $\epsilon$.

Plot: time-continuous sinc, samples for original sampling rate and unshifted times, samples for ϵ-shifted sampling instants Source code under GPLv3 for you to peruse

As you can see, convolution with the "orange dots", i.e. the filter impulse response you get by evaluating the sinc slowly decays (which is good, any interpolation should be dominantely local!), and that means if you truncate the filter (e.g. you stop after 17 values, like I did here), you are causing an error. Choose a longer length, and/or use a windowing function as to meet your accuracy requirements.

Especially when your signal is already not using the full Nyquist bandwidth of your original sampling rate, not using the time-continuous sinc as underlying interpolating function, but the time-continuous version of a signal-preserving low-pass filter will lead to good results.

I don't know how to handle your blocks – that depends. You should just keep the filter taps around – they are the same for all blocks. Whether or not you need to keep the "tail" of your transmission around for the receiving end depends on how you wrote that to work.

Especially if the point of this simulation is to simulate an LTI channel, well, just time-shift the channel (i.e., sinc-interpolate with a shifted filter) and do exactly as you'd do there normally.

$\endgroup$
7
  • 1
    $\begingroup$ This is a nice application for Farrow Filters given they provide a continuously tunable delay as you detailed here: dsp.stackexchange.com/a/52469/21048 $\endgroup$ Commented Jul 5, 2023 at 3:49
  • $\begingroup$ I knew what I was writing sounded like I had written something similar before, but couldn't find it! Thanks :) $\endgroup$ Commented Jul 5, 2023 at 8:42
  • $\begingroup$ Thanks for the answer. In the discrete-time, does this mean I need to produce a new vector $\mathbf{x}_2^{\prime}[t]$ from $\mathbf{x}_2[t]$ by interpolating $\mathbf{x}_2[t]$ using the new time vector? $\endgroup$ Commented Jul 5, 2023 at 10:55
  • $\begingroup$ yes, and my answer explains how you can do that, @Math_Novice. $\endgroup$ Commented Jul 5, 2023 at 11:03
  • 1
    $\begingroup$ because that's the ideal reconstruction filter; remember the theory of sampling signals! $\endgroup$ Commented Jul 6, 2023 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.