# Recovering a signal that was upsampled by non-integer factor

I have a data sequence $G[n]$ that is upsampled at the transmitter of a communication system by a non-integer factor ($1.5$ to be precise). At the receiver, I am supposed to downsample the data and recover the sequence $G[n]$.

In MATLAB, I am implementing both the transmit and receive signals. When I upsample the signal $G[n]$ by integer factors at the transmitter and then downsample the received signal by the same integer factors, I am able to successfully recover the exact $G[n]$, and continue further processing.

However, when I upsample $G[n]$ by a non-integer factor $1.5$, and then downsample the received data by the same factor $1.5$, I do not get the exact sequence $G[n]$ that was transmitted. In MATLAB, for the transmitted sequence, I simply used commands upsample with factor $3$ and downsample with factor $2$. At the receiver I upsampled by factor $2$ and then downsampled by factor $3$.

Is there a way to recover the exact sequence $G[n]$ at the receiver even if it was upsampled by a non-integer factor at the transmitter?

~ryan

• How different are they? If the samples are off by a very small number, you're probably seeing floating-point arithmetic artifacts.
– MBaz
Jun 2 '16 at 14:08

The Sampling operation (both upsample and downsample) depends on two very critical conditions:

1- The existance and applicability of ideal frequency selective filters

2- The operated signal being strictly bandlimited

For most practical systems these two critical conditions are only approximately met. Hence the computational results by those practical systems are only approximate and not exact.

Note that in case of simple but crude interpolation (upsampling) by zero-order hold, which requires no filter at all as being just a sample replication, you can exactly recover the original samples due to the simplicity of the operation.

Unless some advanced algorithms are utilized, therefore, some deviation (but controllable) is expected at the output of any practical sample rate conversion systems.

The matlab functions upsample and downsample just insert zeros, and remove samples respectively. There are big aliasing/imaging problems with using them for fractional resampling that you probably are seeing. (Those imaging and aliasing problems are still there at non-fractional rates too, but happen to cancel each other out specifically when you upsample and then downsample)

You can use interp and decimate instead. Alternatively the function resample is designed specifically for fractional resampling. All of these functions apply resampling filters. I should note however, as others have commented the result after going through those resampling filters will not be perfect.

>> downsample(upsample(downsample(upsample([1 2 3 4 5 6],3),2),2),3)

ans =

1     0     3     0     5     0

>> resample(resample([1 2 3 4 5 6],3,2),2,3)

ans =

1.0154    1.9279    3.1060    3.8622    5.1736    5.7741


P.S. longer sequences will not have nearly as significant error as this example, which is dominated by edge effects.