DSPRelated.com
Forums

Heterodyning, decimating, and sample size

Started by Mikial Chubarov September 18, 2006
Hi Folks,

I�m trying to clear up some mysteries involved in heterodyning in a
real-time system.  (I�m finally getting my feet wet in DSP, dealing with
legacy code at a small player in a niche segment of the signal analyzer
market.  The fathers of this software have all jumped or been pushed
overboard.)

In the interest of brevity I�ll ask my questions using a hypothetical
case: suppose Fs = 8192 s/s, suppose we are interested in the band from
4096 Hz to 8192 Hz, and suppose we collect 500 ms worth of data (4096 real
samples).

It seems to me that:

1)  Application of the frequency shifting theorem results in complex time
series data: whereas the original time series carried amplitude
information only, the complex time series carries twice that much:
knowledge of both phase and amplitude.

2)  As a result of the preceding, we can decimate by a factor of 2 (and
anti-alias filter (lowpass filter?)) and still have enough information to
satisfy Nyquist for a 4096 Hz bandwidth.  At this point we will have 2048
complex samples still spanning 500 ms.  The frequencies that result will
stretch from -2048 Hz to +2048 Hz.

3)  If we again decimate by 2 and anti-alias filter we�ll have 1024
complex samples still spanning 500 ms and the resulting frequencies will
stretch from -1024 Hz to +1024 Hz.

So to do a 1k (complex-to-complex) FFT on 1/2 the full bandwidth we�ll
need to collect 4k real points (ignoring overlap in this discussion), and
with that we�d have a 2 Hz / bin resolution.

Have I got this straight?

Also, is there a better way to take the real time series data to the
complex plane than by multiplying point by point by a complex exponential?
 There�s some indication of this in the code, but I haven�t deciphered it
yet.

Many, many thanks,

Mikial




Mikial Chubarov wrote:

> Hi Folks, > > I�m trying to clear up some mysteries involved in heterodyning in a > real-time system. (I�m finally getting my feet wet in DSP, dealing with > legacy code at a small player in a niche segment of the signal analyzer > market. The fathers of this software have all jumped or been pushed > overboard.) > > In the interest of brevity I�ll ask my questions using a hypothetical > case: suppose Fs = 8192 s/s, suppose we are interested in the band from > 4096 Hz to 8192 Hz, and suppose we collect 500 ms worth of data (4096 real > samples). > > It seems to me that: > > 1) Application of the frequency shifting theorem results in complex time > series data: whereas the original time series carried amplitude > information only, the complex time series carries twice that much: > knowledge of both phase and amplitude.
The original time series would have carried amplitude as well as phase information -- that's inherent in any signal who's frequency is greater than DC.
> > 2) As a result of the preceding, we can decimate by a factor of 2 (and > anti-alias filter (lowpass filter?)) and still have enough information to > satisfy Nyquist for a 4096 Hz bandwidth. At this point we will have 2048 > complex samples still spanning 500 ms. The frequencies that result will > stretch from -2048 Hz to +2048 Hz.
I wouldn't call what I think you're doing mere decimation. You're converting to complex samples, basically by heterodyning, right? Your terminology is confusing but yes, as long as you have 2/T independent samples you can resolve signals out to 1/T.
> > 3) If we again decimate by 2 and anti-alias filter we�ll have 1024 > complex samples still spanning 500 ms and the resulting frequencies will > stretch from -1024 Hz to +1024 Hz.
Well, you should anti-alias filter _first_, then decimate.
> > So to do a 1k (complex-to-complex) FFT on 1/2 the full bandwidth we�ll > need to collect 4k real points (ignoring overlap in this discussion), and > with that we�d have a 2 Hz / bin resolution. > > Have I got this straight?
More or less. With qualifications.
> > Also, is there a better way to take the real time series data to the > complex plane than by multiplying point by point by a complex exponential? > There�s some indication of this in the code, but I haven�t deciphered it > yet. >
The _only_ way to take it to the complex plane is by multiplication by a complex exponential -- but there are significantly more efficient ways to do this than doing it explicitly. Often the best involve choosing your frequencies so that your series goes something like: [ 1 0 -1 0 1 0 -1 0 ...] [ 0 1 0 -1 0 1 0 -1 ...] which certainly simplifies the math... -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
Thanks Tim,

Your answers raise a few questions.

>The original time series would have carried amplitude as well as phase >information -- that's inherent in any signal who's frequency is greater >than DC.
It seems to me that the original real time series samples all have the same relative phase: hence, no imaginary component. And that it�s through multiplication by the complex exponential vector that we impart the relative phases and that this is what gives us the two pieces of information that lets us halve the original number of samples.
>Well, you should anti-alias filter _first_, then decimate.
Hmmm, I hadn�t considered the order of the operations. Thanks.
>The _only_ way to take it to the complex plane is by multiplication by a
>complex exponential -- but there are significantly more efficient ways >to do this than doing it explicitly. Often the best involve choosing >your frequencies so that your series goes something like: > > >[ 1 0 -1 0 1 0 -1 0 ...] >[ 0 1 0 -1 0 1 0 -1 ...] > >which certainly simplifies the math... >
Great! Can you suggest a reference or any keywords for this technique that I could search on to learn more? Much obliged, Mikial
Mikial Chubarov wrote:

   ...

> It seems to me that the original real time series samples all have the > same relative phase: hence, no imaginary component. And that it�s through > multiplication by the complex exponential vector that we impart the > relative phases and that this is what gives us the two pieces of > information that lets us halve the original number of samples.
I see the fruit of misunderstanding here. Sinusoids can be represented as phasors, with real and imaginary parts representing cosines and sines, respectively. The frequencies themselves can be positive, negative, or complex. (At least according to the common representation which may or may not be "reality".) I suspect that you confuse the relations. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
>Your answers raise a few questions. > >>The original time series would have carried amplitude as well as phase >>information -- that's inherent in any signal who's frequency is greater
>>than DC. > >It seems to me that the original real time series samples all have the >same relative phase: hence, no imaginary component. And that it�s
through
>multiplication by the complex exponential vector that we impart the >relative phases and that this is what gives us the two pieces of >information that lets us halve the original number of samples. >
As a concept, you may like to consider the continuous time signal as being the vector sum of two contra-rotating phasors, each of the same frequency, but of half the amplitude. The result will be a real-only sequence. When multiplying by the complex exponential, LP filtering, and decimating by 2, you are isolating one of these contra-rotating vectors - which one depends on the sign of the imaginary part of the complex exponential. What you now have is a complex representation of your signal whose amplitude is half that implied by the original time series.
Thanks guys.

Jerry:

"I see the fruit of misunderstanding here. Sinusoids can be represented 
as phasors, with real and imaginary parts representing cosines and 
sines, respectively. The frequencies themselves can be positive, 
negative, or complex. (At least according to the common representation 
which may or may not be "reality".) I suspect that you confuse the 
relations."

I don't mean to imply that frequencies in the complex exponential scaling
factor are somehow equivalent to, or even related to, the frequencies in
the original data.  Or do I misinterpret you?

Sparks:

"...When multiplying by the complex exponential, LP filtering, and
decimating by 2, you are isolating one of these contra-rotating
vectors..."

Well, that's sort of the rub...

All:

To back up for a moment, my original intent was to justify that �extra�
decimation, by which I mean the following.  Typically, if you filter and
decimate you reduce the sample rate by two and so must reduce the
bandwidth by two as well to satisfy Nyquist.  But when heterodyning we end
up decimating by two yet not halving the bandwidth, which appears to
violate Nyquist.  So, it seems to me, this can only be valid if in fact we
have twice the information.  Isn�t this what happens once we multiply by
the complex exponential � in the time domain we've scaled the original
samples by a sinusoidal amplitude and introduced a rotating phase?

Again, thanks,

Mikial
Mikial Chubarov wrote:
> Thanks guys. > > Jerry: > > "I see the fruit of misunderstanding here. Sinusoids can be represented > as phasors, with real and imaginary parts representing cosines and > sines, respectively. The frequencies themselves can be positive, > negative, or complex. (At least according to the common representation > which may or may not be "reality".) I suspect that you confuse the > relations." > > I don't mean to imply that frequencies in the complex exponential scaling > factor are somehow equivalent to, or even related to, the frequencies in > the original data. Or do I misinterpret you?
... You seemed to say that because a signal has no imaginary component, it has no phase. That's flat wrong, and I was guessing why you think so. Sin(xt), sin(xt + .1), and cos(xt) are all real (for real xt) and none have the same phase. I retract my guess. Please tell me what leads you to your erroneous assertion. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
>Mikial Chubarov wrote: >> Thanks guys. >> >> Jerry: >> >> "I see the fruit of misunderstanding here. Sinusoids can be represented
>> as phasors, with real and imaginary parts representing cosines and >> sines, respectively. The frequencies themselves can be positive, >> negative, or complex. (At least according to the common representation
>> which may or may not be "reality".) I suspect that you confuse the >> relations." >> >> I don't mean to imply that frequencies in the complex exponential
scaling
>> factor are somehow equivalent to, or even related to, the frequencies
in
>> the original data. Or do I misinterpret you? > > ... > >You seemed to say that because a signal has no imaginary component, it >has no phase. That's flat wrong, and I was guessing why you think so. > >Sin(xt), sin(xt + .1), and cos(xt) are all real (for real xt) and none >have the same phase. I retract my guess. Please tell me what leads you >to your erroneous assertion. > >Jerry >-- >Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� >
What I said was same relative phase. I just have amplitude values from sampling. Without knowing the signals apriori I assume their phases, whatever they may be, are constant. But fine, say they are not fixed. I have no problem with that or with being wrong. I only want to understand the reason why the decimation in the heterodyning process does not cut the bandwidth in half. That was my initial question. My search for an answer leads me to consider that multiplying x(t) by e^i*2*pi*t*f0 means we know twice as much about the samples as we did before that operation. We could express the result as a sequence of varying real and imaginary components or as a sequence of varying magnitudes and phases. When I think about decimating this sequence, the second form makes more sense to me: if we pluck out every other sample the changing phase and changing amplitude of the remaining samples is still enough information to determine frequencies up to the original bandwidth. Or so I would think. If I�m incorrect, tell me. But then please tell me as well how to justify that the decimation does not cut the bandwidth in half. Thanks, Mikial
"Mikial Chubarov" <mikialchubarov@ieee.org> wrote in message 
news:jv2dnWHDE__-pI_YnZ2dnUVZ_qudnZ2d@giganews.com...
> > I only want to understand the reason why the decimation in > the > heterodyning process does not cut the bandwidth in half.
It depends on what you mean by "bandwidth". If you mean "the information carrying capacity of a channel", then decimation certainly does reduce the bandwidth of the decimated signal. However, if you mean "the information content of the pre-decimated signal", decimation by itself doesn't change anything. When you decimate, you are making an implicit statement that the pre-decimated signal has no significant information at frequency components above half the post-decimated sampling frequency. Typically, you would low-pass filter after heterodyning and before decimating to insure that this is the case, because higher-frequency components from the pre-decimated signal don't disappear during decimation. Instead, they are aliased into the post-decimated signal.
Mikial Chubarov wrote:

   ...

>> You seemed to say that because a signal has no imaginary component, it >> has no phase. That's flat wrong, and I was guessing why you think so. >> >> Sin(xt), sin(xt + .1), and cos(xt) are all real (for real xt) and none >> have the same phase. I retract my guess. Please tell me what leads you >> to your erroneous assertion.
> What I said was same relative phase. I just have amplitude values from > sampling. Without knowing the signals apriori I assume their phases, > whatever they may be, are constant. But fine, say they are not fixed. I > have no problem with that or with being wrong.
Samples represent instants of *time*. Phase applies to *frequency*, not to time. Time sequences can be represented as sets of harmonically related frequencies by Fourier analysis, and those frequencies have phases. Does that help?
> heterodyning process does not cut the bandwidth in half. That was my > initial question. My search for an answer leads me to consider that > multiplying x(t) by e^i*2*pi*t*f0 means we know twice as much about the > samples as we did before that operation. We could express the result as a > sequence of varying real and imaginary components or as a sequence of > varying magnitudes and phases. When I think about decimating this > sequence, the second form makes more sense to me: if we pluck out every > other sample the changing phase and changing amplitude of the remaining > samples is still enough information to determine frequencies up to the > original bandwidth. Or so I would think. > > If I&#4294967295;m incorrect, tell me. But then please tell me as well how to justify > that the decimation does not cut the bandwidth in half.
Heterodyning is done by non-linear mixing and subsequent extraction on the desired frequency band with a filter. Digitally, the most efficient nonlinearity is usually multiplication, but for some purposes, taking the absolute value is better. Heterodyning accomplishes a frequency translation of the original signal. What is called a "complex mix" also translates a frequency band, but without a filter. Heterodyning isn't related to decimating, although both processes can be wanted for a particular result. Decimating is an operation in time. Heterodyning operates in frequency. 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;