DSPRelated.com
Forums

Decimation/interpolation

Started by Piergiorgio Sartor July 1, 2004
Hi,

I have a, maybe stupid, question about decimation and interpolation.

Let's say we have a signal sampled at 20KHz, so with an useful
bandwidth of 10KHz.

This is ideally low passed at 5KHz, then is downsampled (decimated)
by a factor two.
This means taking one sample and discarding the next, or, in
other words, taking all the even samples, or the odd ones...

Now, in theory taking the odds or the evens is the same, but
in practice?

Is there any practical reason (maybe due to quantization), why
to choose the odds or the evens?

Same situation, but with the filter going from 5KH to 10KHz,
keeping the upper 5KHz band.

In this case is also possible to downsample by a factor two
and the same question comes: odd or even?

Specifically, in both cases, the choice should be done in order
to reconstruct (interpolate) the original signal, later.

Thanks,

bye,

-- 
   Piergiorgio Sartor
"Piergiorgio Sartor" <piergiorgio.sartor@nexgo.REMOVE.THIS.de> wrote in
message news:40e3c16c$0$286$4d4ebb8e@read.news.de.uu.net...
> Hi, > > I have a, maybe stupid, question about decimation and interpolation. > > Let's say we have a signal sampled at 20KHz, so with an useful > bandwidth of 10KHz. > > This is ideally low passed at 5KHz, then is downsampled (decimated) > by a factor two. > This means taking one sample and discarding the next, or, in > other words, taking all the even samples, or the odd ones... > > Now, in theory taking the odds or the evens is the same, but > in practice? > > Is there any practical reason (maybe due to quantization), why > to choose the odds or the evens? > > Same situation, but with the filter going from 5KH to 10KHz, > keeping the upper 5KHz band. > > In this case is also possible to downsample by a factor two > and the same question comes: odd or even? > > Specifically, in both cases, the choice should be done in order > to reconstruct (interpolate) the original signal, later. >
Piergiorgio, I don't think it matters much unless you have some very particular requirements. For example, if you throw out the zeroeth sample (even) then you won't have the "beginning" sample. Normally that doesn't matter because of filter transient response times, etc. Otherwise, and particularly for a streaming sort of application, it shouldn't matter. It shouldn't matter because "even" and "odd" are actually pretty arbitrary: Try this: Take a very long sequence of samples. Take an arbitrary chunk of samples from the middle of this sequence - defining the zeroeth sample as the first one in the sequence. Remove all the "odd" samples. Now, go back and take a slightly different chunk of samples that includes the original chunk above except the first sample - again defining the zeroeth sample as the first one in this new sequency. Remove all the "odd" samples. Now you have a sequence that is made up of what were the "even" samples from the first step. The only difference is a "shift" of one sample interval. Presumably if you are keeping track of time vs. sample index that won't matter. Fred
Piergiorgio Sartor wrote:
> Hi, > > I have a, maybe stupid, question about decimation and interpolation. > > Let's say we have a signal sampled at 20KHz, so with an useful > bandwidth of 10KHz. > > This is ideally low passed at 5KHz, then is downsampled (decimated) > by a factor two. > This means taking one sample and discarding the next, or, in > other words, taking all the even samples, or the odd ones... > > Now, in theory taking the odds or the evens is the same, but > in practice? > > Is there any practical reason (maybe due to quantization), why > to choose the odds or the evens? > > Same situation, but with the filter going from 5KH to 10KHz, > keeping the upper 5KHz band. > > In this case is also possible to downsample by a factor two > and the same question comes: odd or even? > > Specifically, in both cases, the choice should be done in order > to reconstruct (interpolate) the original signal, later. > > Thanks, > > bye, >
If you were just going from 20kHz to 10kHz the correct answer would be that "odd" and "even" have no meaning. But it sounds like you want to be able to split your sample train in two, and reconstruct a perfect version later? In this case you are going to be limited in your choices of filters, and you're going to have to pay attention to which samples you keep. Here's some suggestions: 1. Do you really need to filter? If you're not going to listen to the data until it's reconstructed then just put all the even samples into one stream and the odd ones in the other. 2. This may be a job for wavelet transforms -- but you've just gotten everything from me that I know about wavelet transforms. 2a. Except that I do know you can use wavelets to form perfectly overlapping frequency bands -- I'm just not sure if they've been used for exactly this application before. 3. Consider taking pairs of samples. Into one channel put in the average value of the pair (x_{k-1} + x_k)/2. Into the other channel put the difference between the pair (x_{k-1} - x_k)/2. Your bandlimiting won't be perfect, but you will have all the data you need to reconstruct the original signal. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
"Piergiorgio Sartor" <piergiorgio.sartor@nexgo.REMOVE.THIS.de> wrote in
message news:40e3c16c$0$286$4d4ebb8e@read.news.de.uu.net...
> Hi, > > I have a, maybe stupid, question about decimation and interpolation. > > Let's say we have a signal sampled at 20KHz, so with an useful > bandwidth of 10KHz. > > This is ideally low passed at 5KHz, then is downsampled (decimated) > by a factor two. > This means taking one sample and discarding the next, or, in > other words, taking all the even samples, or the odd ones... > > Now, in theory taking the odds or the evens is the same, but > in practice? > > Is there any practical reason (maybe due to quantization), why > to choose the odds or the evens?
None that I can think of. Your odd sample could become an even sample if you just started your data acquisition with a delay. I like to get things started with a positive attitude, so I tend to start dropping samples starting with the 2nd (not the first) :-))
> > Same situation, but with the filter going from 5KH to 10KHz, > keeping the upper 5KHz band. > > In this case is also possible to downsample by a factor two > and the same question comes: odd or even? > > Specifically, in both cases, the choice should be done in order > to reconstruct (interpolate) the original signal, later. > > Thanks, > > bye, > > -- > Piergiorgio Sartor
Piergiorgio Sartor wrote:

> Hi, > > I have a, maybe stupid, question about decimation and interpolation. > > Let's say we have a signal sampled at 20KHz, so with an useful > bandwidth of 10KHz. > > This is ideally low passed at 5KHz, then is downsampled (decimated) > by a factor two. > This means taking one sample and discarding the next, or, in > other words, taking all the even samples, or the odd ones... > > Now, in theory taking the odds or the evens is the same, but > in practice? > > Is there any practical reason (maybe due to quantization), why > to choose the odds or the evens? > > Same situation, but with the filter going from 5KH to 10KHz, > keeping the upper 5KHz band. > > In this case is also possible to downsample by a factor two > and the same question comes: odd or even? > > Specifically, in both cases, the choice should be done in order > to reconstruct (interpolate) the original signal, later. > > Thanks, > > bye,
Would the original set of samples still be representative if the sampling clock had started 50 microseconds later or earlier? Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
"Piergiorgio Sartor" <piergiorgio.sartor@nexgo.REMOVE.THIS.de> wrote in
message news:40e3c16c$0$286$4d4ebb8e@read.news.de.uu.net...
> Specifically, in both cases, the choice should be done in order > to reconstruct (interpolate) the original signal, later.
I think you want to Google for quadrature mirror filter banks. -- Matt
Piergiorgio Sartor <piergiorgio.sartor@nexgo.REMOVE.THIS.de> wrote in message news:<40e3c16c$0$286$4d4ebb8e@read.news.de.uu.net>...
> Hi, > > I have a, maybe stupid, question about decimation and interpolation. > > Let's say we have a signal sampled at 20KHz, so with an useful > bandwidth of 10KHz. > > This is ideally low passed at 5KHz, then is downsampled (decimated) > by a factor two. > This means taking one sample and discarding the next, or, in > other words, taking all the even samples, or the odd ones... > > Now, in theory taking the odds or the evens is the same, but > in practice? > > Is there any practical reason (maybe due to quantization), why > to choose the odds or the evens? > > Same situation, but with the filter going from 5KH to 10KHz, > keeping the upper 5KHz band. > > In this case is also possible to downsample by a factor two > and the same question comes: odd or even? > > Specifically, in both cases, the choice should be done in order > to reconstruct (interpolate) the original signal, later. > > Thanks, > > bye,
No, in theory they are NOT the same when you are taking even and odd samples. Because the odd sequence is one sample delay(essentialy), so its spectrum in frequency domain is expanding by 2 and then shifting by pi from the original sequence spectrum. Its even sequence spectrum is expanding by 2 from original sequence spectrum. In practice, obvious they are NOT the same either: they are two different sequences in terms of element-wise in each sequence. As the last post mentioned, QMF bank should be a good starting point if you want to do perfect reconstruction with such structure. I guess you might be confuesd by some concepts. Just my 2 cents.
Steve wrote:

> Piergiorgio Sartor <piergiorgio.sartor@nexgo.REMOVE.THIS.de> wrote in message news:<40e3c16c$0$286$4d4ebb8e@read.news.de.uu.net>... > >>Hi, >> >>I have a, maybe stupid, question about decimation and interpolation. >> >>Let's say we have a signal sampled at 20KHz, so with an useful >>bandwidth of 10KHz. >> >>This is ideally low passed at 5KHz, then is downsampled (decimated) >>by a factor two. >>This means taking one sample and discarding the next, or, in >>other words, taking all the even samples, or the odd ones... >> >>Now, in theory taking the odds or the evens is the same, but >>in practice? >> >>Is there any practical reason (maybe due to quantization), why >>to choose the odds or the evens? >> >>Same situation, but with the filter going from 5KH to 10KHz, >>keeping the upper 5KHz band. >> >>In this case is also possible to downsample by a factor two >>and the same question comes: odd or even? >> >>Specifically, in both cases, the choice should be done in order >>to reconstruct (interpolate) the original signal, later. >> >>Thanks, >> >>bye, > > > No, in theory they are NOT the same when you are taking even and odd > samples. Because the odd sequence is one sample delay(essentialy), so > its spectrum in frequency domain is expanding by 2 and then shifting > by pi from the original sequence spectrum. Its even sequence spectrum > is expanding by 2 from original sequence spectrum. > > In practice, obvious they are NOT the same either: they are two > different sequences in terms of element-wise in each sequence. > > As the last post mentioned, QMF bank should be a good starting point > if you want to do perfect reconstruction with such structure. I guess > you might be confuesd by some concepts. > > Just my 2 cents.
Of course they're not the same, but there's no reason to prefer one to the other. If each is separately converted to analog, they will be seen to differ only in time -- 50 microsec, one sample time -- and not at all in frequency. With a one-sample delay in the early channel, the analog outputs will be identical despite the differences between the digital streams. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Jerry Avins wrote:

> Would the original set of samples still be representative if the > sampling clock had started 50 microseconds later or earlier?
I think delay does not matter. Actually I forgot one point, the samples are finite in time. I mean there are, for example, 10 million samples to which this process should be applied. My concern was related to the fact that samples are quantized, so the 5 million odd or even can have different quantization error, or maybe not... The sequence: 1, 2, 3, 5 has more information in 1 and 3 or in 2 and 5? Or is _always_ the same? When reconstructing, I assume we will have to deal with rounding and so on. So is there any way to choose odd or even in order to minimize the effect of the finite precision in the reconstruction process? Of course one can recontruct from odd and even and see what is better, I was wondering if there is a way to know this before. Maybe the question is not clear, since it is not clear even in my mind... :-) Thanks, bye, -- Piergiorgio Sartor
Steve wrote:

> No, in theory they are NOT the same when you are taking even and odd > samples. Because the odd sequence is one sample delay(essentialy), so > its spectrum in frequency domain is expanding by 2 and then shifting > by pi from the original sequence spectrum. Its even sequence spectrum > is expanding by 2 from original sequence spectrum.
I meant in "reconstruction theory". As far as I know, in order to reconstruct the signal, regardless of delay, odd or even should be the same. But also regardless of finite precision math. bye, -- Piergiorgio Sartor