DSPRelated.com
Forums

New to DSP, need to understand decimation

Started by Tamara May 9, 2006
Hello.

I am new to the DSP area.  So.. I am just going to throw all my questions
out there so you can see how lost I am... and maybe have yourself a
chuckle :-)  I realize my questions are in different areas but I wanted to
put it all together.  Any help would be greatly appreciated and would point
me in the right direction.   

The problem (at it's minimum):  I receive 2 channels bandpass pre-filtered
260MHz IF with a BW of 40MHz. I need phase coherent sampling, digital down
conversion, doppler shift, programmable decimation/filtering( 2K output
BWs), and 2.5 hours output of the complex data at a 25-50Mhz rate dumped
to a computer disk. 

Downconvert: My first attempt was to learn undersampling techniques which
I found a lot of great info on the web.  I calculated a sampling frequency
Fs = 80MHz.  This will bring the signal to baseband between 0 and 40MHz. 
Since this will be implemented in a FPGA, how do I determine how many
samples the ADC needs to take?

Now this is where I am stuck.  I think the proper order is downconvert,
phase shift, decimate, and filter.  I might be missing a low pass filter
stage but not sure where it belongs?

Phase shifting:  I'm hoping I can phase shift and convert to complex data
at the same time.  Can I do this with cosine/sine Look up tables and
multipliers?  Is this the same as a NCO?  Is a NCO the same as a DDS?  The
doppler needs to be calculated and the shift be programmable with 1 kHz
update rate, and a resolution of 0.1 Hz / sample rate in MHz.  What about
the Hilbert transform?  

Decimation:  Since I undersampled, this simplifies the decimation stage
portion.  My sampling freq is Fs = 80MHz, does this mean I only have one
choice of decimation rate = 2. My output bandwidth is programmable between
25-50MHz/sample.  At an output over 40MHz I would not be able to decimate  
It seems there is a lot of ways to decimate CIC, boxcar, multirate,
polyphase, Is there any good info on the web or a good book that can tell
me the difference between these?... Do they only decimate or can they also
pull the narrowband signal from wideband?  It seems to me that I should low
pass filter before decimating but isn't that the whole purpose of
decimating is to save me multipliers? Why do I need a FIR filter to
decimate when it is just me throwing away every other sample? 

Filter: How do I decide how many taps my filter will be? 

Thank-you...

Tamara


Tamara wrote:

> Hello. > > I am new to the DSP area. So.. I am just going to throw all my questions > out there so you can see how lost I am... and maybe have yourself a > chuckle :-) I realize my questions are in different areas but I wanted to > put it all together. Any help would be greatly appreciated and would point > me in the right direction. > > The problem (at it's minimum): I receive 2 channels bandpass pre-filtered > 260MHz IF with a BW of 40MHz. I need phase coherent sampling, digital down > conversion, doppler shift, programmable decimation/filtering( 2K output > BWs), and 2.5 hours output of the complex data at a 25-50Mhz rate dumped > to a computer disk. > > Downconvert: My first attempt was to learn undersampling techniques which > I found a lot of great info on the web. I calculated a sampling frequency > Fs = 80MHz. This will bring the signal to baseband between 0 and 40MHz. > Since this will be implemented in a FPGA, how do I determine how many > samples the ADC needs to take?
I must be missing something: A sampling frequency of 80MHz means that your ADC must run at 80MHz. That's all. You have made the World's Most Common DSP Sophism: The Nyquist limit is an absolute, _theoretical_ bound, _not_ a practical bound that you can design to. Nyquist needs to be observed the way you observe breaking strength on an aircraft wing: with a great deal of margin. To deal with this decide how much aliasing you can stand (usually you can just treat aliased data as noise). Take a look at the attenuation vs. frequency of your IF filter, and pick a bandwidth that gets you no more than your desired aliasing amount. For example, if your filters have a 2:1 shape factor then you'll be 60dB down at 220MHz and 300MHz. One way or another I'd sample at Fs = 260MHz / (n + 1/2). This puts the peak of your passband right in the middle of your sampled data stream, which is where you want it to be. In your case the two candidates are Fs = 104MHz, which centers your passband at 52MHz, or Fs = 74.29MHz, which centers your passband at 37.14MHz.
> > Now this is where I am stuck. I think the proper order is downconvert, > phase shift, decimate, and filter. I might be missing a low pass filter > stage but not sure where it belongs?
Downconvert, filter, phase shift and decimate. I'll address phase shifting in the next section.
> > Phase shifting: I'm hoping I can phase shift and convert to complex data > at the same time. Can I do this with cosine/sine Look up tables and > multipliers? Is this the same as a NCO? Is a NCO the same as a DDS? The > doppler needs to be calculated and the shift be programmable with 1 kHz > update rate, and a resolution of 0.1 Hz / sample rate in MHz. What about > the Hilbert transform?
You don't mention, though, what frequency range you need to shift over. Phase shifting and converting to complex data can be one and the same. Assuming that you sample at 104MHz your center frequency will be at 52MHz. Calculate cos(2*pi*n*(52MHz + shift)/104MHz) and sin(2*pi*n*(52MHz + shift)/104MHz), and multiply these numbers by your data stream. The cosine result is your inphase data, and the sine result is your quadrature data. You will need to filter the result, but you can do that in the decimation phase.
> > Decimation: Since I undersampled, this simplifies the decimation stage > portion. My sampling freq is Fs = 80MHz, does this mean I only have one > choice of decimation rate = 2.
No, but in an FPGA it may be wise to use integer decimation rates.
> My output bandwidth is programmable between > 25-50MHz/sample. At an output over 40MHz I would not be able to decimate
With I-Q ("complex") data you can decimate -- Nyquist says you have to have twice as many total samples as your data, but one I sample and one Q sample counts as two. With a good filter you'd be able to maintain close to a 40MHz bandwidth and a 54MHz sample rate.
> It seems there is a lot of ways to decimate CIC, boxcar, multirate, > polyphase, Is there any good info on the web or a good book that can tell > me the difference between these?
"CIC" and "boxcar" both refer to filter types. In fact a boxcar is the starting point for a CIC. Multirate and polyphase refer to downsampling techniques. "Understanding Digital Signal Processing" by Rick Lyons is good, possibly the best for a beginner. He goes into sample rate conversion in depth, even though he only mentions undersampling in passing. You can buy a copy (and get me a kickback) at http://www.powells.com/partner/30696/biblio/0-13-108989-7.
> ... Do they only decimate or can they also > pull the narrowband signal from wideband? It seems to me that I should low > pass filter before decimating but isn't that the whole purpose of > decimating is to save me multipliers?
Decimating can save you multiplies, but not necessarily multipliers. There are filters that are easy on the math resources, though.
> Why do I need a FIR filter to > decimate when it is just me throwing away every other sample? > > Filter: How do I decide how many taps my filter will be?
The number of taps necessary is a function of how nice you want your final result to be -- more taps = better, but more taps = more math. It's a tradeoff you usually resolve with a math package and a bunch of hair-tearing. -- 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
Tim.  

Thanks - That really helped me.  I just started a new job at the Arecibo
Observatory and every day I get a little further.    

I worked through your example where Fs = 104MHz.  Given Fa = passband
signal, I have 2Fs-Fa and Fs+Fa overlapping.  Does the passband centered
at 52MHz need to be swapped since it is an alias frequency component
Fs-fa?  Can I use Matlab to verify undersampling techniques?  

>You don't mention, though, what frequency range you need to shift over.
Oooh this is because I don't have enough understanding of how to calculate the doppler shift for radar data taking. I have a feeling I will have to determine the phase given some complicated polynomial and update at intervals.
>"Understanding Digital Signal Processing" by Rick Lyons is good, >possibly the best for a beginner.
Do I need to enter a code for you to get credit ??? Thanks again... Tamara
Tamara wrote:

> Tim. > > Thanks - That really helped me. I just started a new job at the Arecibo > Observatory and every day I get a little further. > > I worked through your example where Fs = 104MHz. Given Fa = passband > signal, I have 2Fs-Fa and Fs+Fa overlapping. Does the passband centered > at 52MHz need to be swapped since it is an alias frequency component > Fs-fa?
I am profoundly glad you caught that. I wrote that in a hurry, jumped in my car, and realized my mistake when I was about four miles down the road. You have the right idea to look at the overlapping, though -- that's really the essence of setting sampling rates, the Nyquist criterion often just confuses things.
> Can I use Matlab to verify undersampling techniques? >
Yes, in two ways. One, you can plot your IF spectrum shifted over by all the harmonics of the sampling rate. Remember that the IF spectrum is reflected around 0Hz, so content at 260MHz means content at -260MHz -- and 260MHz - 208MHz = 312MHz - 260MHz (gawd). Ideally you want a sampling rate that will leave your various IF aliases _not_ overlapping anything important. Try this overlapping thing with your 80MHz -- you'll see that the IF reflects around 240MHz, where a nominal 40MHz wide filter centered at 260MHz will only be 6dB down. I think you'll find that you'll need to sample a good deal over 80MHz -- I'm thinking 120MHz or more. Two, you can generate simulated signals and sample them (with or without Simulink), then test the resulting data stream to see if it's behaving the way you think it should.
> >>You don't mention, though, what frequency range you need to shift over. > > > Oooh this is because I don't have enough understanding of how to calculate > the doppler shift for radar data taking. I have a feeling I will have to > determine the phase given some complicated polynomial and update at > intervals. >
If I remember correctly the doppler shift is an easy straight-line relationship if you know the speeds involved and the frequencies. Knowing the relative velocities is a different thing, though.
> >>"Understanding Digital Signal Processing" by Rick Lyons is good, >>possibly the best for a beginner. > > > Do I need to enter a code for you to get credit ??? >
As far as I know you just click that link and buy -- Powell's takes care of getting me my pittance. -- 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
Tamara wrote:
> Filter: How do I decide how many taps my filter will be?
Well, in the first place, you gotta determine the rolloff bandwidth you want for your FIR. Then, calculate 4 / (rolloff bandwidth/sample rate) and take the nearest odd integer, there you got your tap count for your FIR. It gives you exactly the right rolloff bandwidth. That's why the windowed-sinc generation function I use takes the rolloff bandwidth as a parameter instead of the number of taps, gets just what I need and makes sure it has an odd number of taps.
"Tamara" <thall@naic.edu> wrote in message 
news:ysudnQVU3KyXgvzZnZ2dnUVZ_sOdnZ2d@giganews.com...
> > Tim. > > Thanks - That really helped me. I just started a new job at the Arecibo > Observatory and every day I get a little further. > >> > Oooh this is because I don't have enough understanding of how to calculate > the doppler shift for radar data taking. I have a feeling I will have to > determine the phase given some complicated polynomial and update at > intervals. >
Hello Tamara, The correct formula for the relativistic Doppler shift is f' = f sqrt( (c-v)/(c+v) ) where f' is new frequency f is old frequency c is speed of light which is exactly 299792458 meters per second v is relative velocity between emitter and detector IHTH, Clay p.s. you will want this version since radio sources in radioastronomy can have large doppler shifts hence large velocities so relativity actually matters.