Reply by yogesh_gharote March 5, 20112011-03-05
thanx rb-j for the reply.what u told was what i was also expecting but 
it so happened that i could not get the field results tally with the theory
so i thought to get some views from u folks.

thanx Tim , ur article on sampling is quite enlightening & thanx for ur
views & comments.

thanx Fred , by the way i am not at all a "student" with a homework problem
or an assignment ( though i would love to be one throughout my active
career duration) ; I am a DSP professional though may not be as enlightened
as u are & yes i must say that u r a good detective in sniffing out the
stuff but let me tell u that the post was neither a troll nor a red herring
but i apologize for being too brief or rather incomplete in defining the
problem. u r right the question was in the context of a much larger system
but i thought to be "to the point" & eventually missed out important
details. But thanx for ur views. I did get some interesting stuff from ur
replies.

Regards,
Yogesh P.G. 
Reply by robert bristow-johnson March 5, 20112011-03-05
On Mar 4, 8:07�am, "yogesh_gharote"
<yogesh_gharote@n_o_s_p_a_m.yahoo.com> wrote:
> &#4294967295; &#4294967295; I have a ADC system which samples at 160 MHz . I am passing the data > through a narrowband FIR filter of bandwidth 2.5 MHz . This also amounts to > saying that i can filter & decimate the data sequence (to the input of the > filter) by a factor of 32 (80/2.5 = 32) . The FIR is implemented as a > polyphase structure. > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; Filter specs are as follows: > Input data rate : 160 MHz (160 mega samples/sec) > filter bandwidth : 2.5 MHz > passband ripple : 0.1 dB > stopband attenuation : 100 dB
do you know where your passband ends and your stopband begins? is the "filter bandwidth" somewhere in between?
> &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; Before filtering & decimation the spectrum is from -80 to +80 > MHz. After that , the spectrum is from -2.5 to +2.5 MHz. If seen at the > output of the filter , What is the equivalent ripple & the stopband > attenuation?
what you said above.
> Does it remain the same as mentioned above or does it degrade > due to fold over due to decimation? &#4294967295;
what happens when you decimate by a factor of 32 is that, at the new sample rate of 5 MHz, it's pretty flat from -Nyquist to +Nyquist. the pre-filter content above 2.5 Mhz, that gets beaten down 100 dB will become sorta like noise and its spectrum will repeat at shifted intervals spaced by 5 MHz and overlap and add. you can figure out what that is, with 31 times the power spectrum density level above 2.5 MHz and that beaten down 100 dB. r b-j
Reply by Fred Marshall March 4, 20112011-03-04
On 3/4/2011 5:06 PM, Tim Wescott wrote:
> On Fri, 04 Mar 2011 12:54:49 -0800, Fred Marshall wrote: > >> On 3/4/2011 10:58 AM, Tim Wescott wrote: >>> I think that (a), this won't give you something that you can state >>> without qualifications is a "frequency response" >> >> Hmm... maybe we're talking about different things. I surely didn't >> suggest having any signal components in this calculation. Only a >> repeated *real* frequency response / overlapped by circular convolution >> by a sequence of fairly widely spaced unit samples. >> >> So, I think that results in a real frequency response which is >> accompanied by decimation in time (a multiplication corresponding to the >> frequency convolution). > > Consider a filter who's response is 1 at 0 Hz, diminishing linearly to 0 > at 20MHz. Now convolve it the way you suggest. You will get, if I am > not mistaken, a perfectly flat response. But a significant portion of > the energy in this response will be aliasing -- not any useful signal. > > Is it accurate, or misleading, to say that the filter is "nice and flat"? > >
That's not what I intended. The decimated sample rate would have to be 40Mhz in this case ... and, you didn't say where we were starting with fs. Just to be clear: A lowpass with pass and transition band 20Mhz and stopband thereafter with some reasonable stopband ripple. Just as you've suggested. Make the non-stopband shape anything you want. Sample rate 160Mhz. Now let's decimate the filter in time by 4 / reduce the sample rate by 4. To do this in frequency: convolve the filter response with unit samples every 40Mhz. The passbands will be perturbed a bit and the stopbands as well but the general shape will remain. And the repeating passbands will come closer together. The point of the exercise was to compute the filter ripples after the convolution. So, if the sample rate is chosen poorly or the decimation factor chosen poorly then indeed stuff will overlap too much just as you've suggested. I was trying to deal with a *real* case that would work. If some student starts with bad numbers then this will also tell them the results are crappy. In this I think we agree. Then maybe he/she will *think* about it and maybe ask some informed questions. Fred
Reply by Tim Wescott March 4, 20112011-03-04
On Fri, 04 Mar 2011 12:54:49 -0800, Fred Marshall wrote:

> On 3/4/2011 10:58 AM, Tim Wescott wrote: >> I think that (a), this won't give you something that you can state >> without qualifications is a "frequency response" > > Hmm... maybe we're talking about different things. I surely didn't > suggest having any signal components in this calculation. Only a > repeated *real* frequency response / overlapped by circular convolution > by a sequence of fairly widely spaced unit samples. > > So, I think that results in a real frequency response which is > accompanied by decimation in time (a multiplication corresponding to the > frequency convolution).
Consider a filter who's response is 1 at 0 Hz, diminishing linearly to 0 at 20MHz. Now convolve it the way you suggest. You will get, if I am not mistaken, a perfectly flat response. But a significant portion of the energy in this response will be aliasing -- not any useful signal. Is it accurate, or misleading, to say that the filter is "nice and flat"? -- http://www.wescottdesign.com
Reply by Fred Marshall March 4, 20112011-03-04
On 3/4/2011 10:58 AM, Tim Wescott wrote:
> I think that (a), this won't give you something that you can state > without qualifications is a "frequency response"
Hmm... maybe we're talking about different things. I surely didn't suggest having any signal components in this calculation. Only a repeated *real* frequency response / overlapped by circular convolution by a sequence of fairly widely spaced unit samples. So, I think that results in a real frequency response which is accompanied by decimation in time (a multiplication corresponding to the frequency convolution). Fred
Reply by Tim Wescott March 4, 20112011-03-04
On 03/04/2011 10:45 AM, Fred Marshall wrote:
> On 3/4/2011 5:07 AM, yogesh_gharote wrote: > >> What is the equivalent ripple& the stopband >> attenuation? Does it remain the same as mentioned above or does it >> degrade >> due to fold over due to decimation? >> >> Regards, >> Yogesh P.G. > > Completely neglecting the passband kind of issues you imply here, here's > a suggestion for a simpler situation: > > Compute the frequency response of the filter. Best if you do this so the > frequency response is purely real - which it will be if you center a > symmetrical FIR at t=0. This likely means splitting it up in time so the > fist part is above NT/2 and the last part starts at t=0. > Also best to do this with high resolution (lots of zeros padding the > filter response in the middle of the sequence). > > Then, circularly convolve the frequency response (in frequency) with > unit samples occurring at 0, fs/32, 2fs/32, 3fs/32 .... etc. which will > represent your new sampling frequency. > > After the convolution, you will have the new filter's frequency response. > > It should be easy then to see what happens.
This actually leads straight to what I was saying about the results being hard to interpret. I think that (a), this won't give you something that you can state without qualifications is a "frequency response", and (b), this the one picture of many that you'll get out of this won't be a useful one, anyway. Two similar things you can do that _will_ be useful (but will only be partial views), would be to either square the frequency response, circularly convolve it, and take the square root, or to take the absolute value of the frequency response and circularly convolve it. In the first case (square, convolve, root), you'll get the noise spectrum out of your filter for white noise in. Call it the "noise response". Lay it on top of the response for just the fundamental, and you can estimate how much noise you're adding in. Better yet, start by squaring the frequency response, then convolving it with everything _but_ 0Hz, then taking the square root. This will be the spectrum of the excess interference that you're adding into the signal. In the second case (absolute, convolve), you'll get the worst-case spectrum out of your filter, for pathalogical cases where your interfereing signals are somehow coherent to, and opposing, your intended signal. Once again, plot this against the intended spectrum, or don't convolve the intended spectrum in. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by Fred Marshall March 4, 20112011-03-04
On 3/4/2011 5:07 AM, yogesh_gharote wrote:

>What is the equivalent ripple& the stopband > attenuation? Does it remain the same as mentioned above or does it degrade > due to fold over due to decimation? > > Regards, > Yogesh P.G.
Completely neglecting the passband kind of issues you imply here, here's a suggestion for a simpler situation: Compute the frequency response of the filter. Best if you do this so the frequency response is purely real - which it will be if you center a symmetrical FIR at t=0. This likely means splitting it up in time so the fist part is above NT/2 and the last part starts at t=0. Also best to do this with high resolution (lots of zeros padding the filter response in the middle of the sequence). Then, circularly convolve the frequency response (in frequency) with unit samples occurring at 0, fs/32, 2fs/32, 3fs/32 .... etc. which will represent your new sampling frequency. After the convolution, you will have the new filter's frequency response. It should be easy then to see what happens. Fred
Reply by Tim Wescott March 4, 20112011-03-04
On 03/04/2011 05:07 AM, yogesh_gharote wrote:
> I have a ADC system which samples at 160 MHz . I am passing the data > through a narrowband FIR filter of bandwidth 2.5 MHz . This also amounts to > saying that i can filter& decimate the data sequence (to the input of the > filter) by a factor of 32 (80/2.5 = 32) . The FIR is implemented as a > polyphase structure. > Filter specs are as follows: > Input data rate : 160 MHz (160 mega samples/sec) > filter bandwidth : 2.5 MHz > passband ripple : 0.1 dB > stopband attenuation : 100 dB > Before filtering& decimation the spectrum is from -80 to +80 > MHz. After that , the spectrum is from -2.5 to +2.5 MHz. If seen at the > output of the filter , What is the equivalent ripple& the stopband > attenuation? Does it remain the same as mentioned above or does it degrade > due to fold over due to decimation?
Unless you are sampling in quadrature and have not told us, you are severely in error in your system design. Normally when someone states "filter bandwidth" they are stating the bandwidth to the _start_ of rolloff, i.e. the useful bandwidth of data that you're going to be getting out of the filter. For the purposes of establishing your correct decimation factor, you need to look at the width of the filter at the points where the stop-band starts. This width depends on the shape factor of your filter. It can't be 2.5MHz, because no real filter has a 1:1 shape factor. If you did decimate down to 5MHz, you would be folding the spectrum back at the 2.5MHz filter edges, and all of the unwanted signal energy that gets past the filter skirts would fold back into your desired signal. "Passband ripple" and "stop-band attenuation" would become almost meaningless terms, until you defined whether you meant the ripple of the desired passband ignoring the folded-back energy, or if you meant the ripple of the whole thing, folded-back energy and all. You wouldn't have a stop-band. If you decimated down to 10MHz, or 15, or 20, or whatever you need so that your stop-band is actually within the Nyquist rate of your decimated sampling rate, then your passband ripple wouldn't change by more than 10^-5. You'd have the same argument over stop-band attenuation as before, but it wouldn't go up more than 6dB, and if you had more than 106dB from Nyquist on out, then it wouldn't go above 100dB. This article doesn't hit your issue right on the head, but the examples for RF comms do come close: http://www.wescottdesign.com/articles/Sampling/sampling.pdf -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by Fred Marshall March 4, 20112011-03-04
On 3/4/2011 5:07 AM, yogesh_gharote wrote:
> I have a ADC system which samples at 160 MHz . I am passing the data > through a narrowband FIR filter of bandwidth 2.5 MHz . This also amounts to > saying that i can filter& decimate the data sequence (to the input of the > filter) by a factor of 32 (80/2.5 = 32) . The FIR is implemented as a > polyphase structure. > Filter specs are as follows: > Input data rate : 160 MHz (160 mega samples/sec) > filter bandwidth : 2.5 MHz > passband ripple : 0.1 dB > stopband attenuation : 100 dB > Before filtering& decimation the spectrum is from -80 to +80 > MHz. After that , the spectrum is from -2.5 to +2.5 MHz. If seen at the > output of the filter , What is the equivalent ripple& the stopband > attenuation? Does it remain the same as mentioned above or does it degrade > due to fold over due to decimation? > > Regards, > Yogesh P.G.
Yogesh, This almost sounds like a homework problem presented in the context of something the prof. was trying to get across. So, if that's the case then the context is missing - not to mention that we generally won't give homework answers ... just some illumination perhaps. By context, I'm not at all sure just *how* you've implemented the polyphase filter and that might (might not) make a difference. I'm more comfortable knowing these things.... Just let me say this: Don't confuse the sample rate with the signal bandwidth. Work it out. Draw yourself some spectral cartoons to visualize it. Is this a troll? Or are those questions a red herring? From the numbers you've given, there is a lot bigger problem than the "equivalent ripple". Fred
Reply by yogesh_gharote March 4, 20112011-03-04
    I have a ADC system which samples at 160 MHz . I am passing the data
through a narrowband FIR filter of bandwidth 2.5 MHz . This also amounts to
saying that i can filter & decimate the data sequence (to the input of the
filter) by a factor of 32 (80/2.5 = 32) . The FIR is implemented as a
polyphase structure. 
          Filter specs are as follows:
Input data rate : 160 MHz (160 mega samples/sec)
filter bandwidth : 2.5 MHz
passband ripple : 0.1 dB
stopband attenuation : 100 dB
          Before filtering & decimation the spectrum is from -80 to +80
MHz. After that , the spectrum is from -2.5 to +2.5 MHz. If seen at the
output of the filter , What is the equivalent ripple & the stopband
attenuation? Does it remain the same as mentioned above or does it degrade
due to fold over due to decimation?   

Regards,
Yogesh P.G.