DSPRelated.com
Forums

Decimation design

Started by seb March 27, 2004
Hello,

I am looking for good advices about my design.

I am working with an ADC which work beetween 1kHz and 2kHz but the
application need data sampled beetween 10 Hz and 2 kHz. So i decide to
make decimation in order to get the sample frequence beetween 10Hz and
1 kHz. But in order to do it in the rigth way i make pre-filtering in
order to avoid aliasing.

So the decimation factor could be as high as 100 (1kHz to 10 Hz). So i
need to store 100 FIR filter, one for 2-decimation , one for
3-decimation and so on.
I need 100 FIR filter and the one use to obtain the 10 Hz has an order
of 700 (wp = 5 Hz, ws = 10 Hz) !!!

I am sure there are some more elegant solution.....
seb wrote:

> Hello, > > I am looking for good advices about my design. > > I am working with an ADC which work beetween 1kHz and 2kHz but the > application need data sampled beetween 10 Hz and 2 kHz. So i decide to > make decimation in order to get the sample frequence beetween 10Hz and > 1 kHz. But in order to do it in the rigth way i make pre-filtering in > order to avoid aliasing. > > So the decimation factor could be as high as 100 (1kHz to 10 Hz). So i > need to store 100 FIR filter, one for 2-decimation , one for > 3-decimation and so on. > I need 100 FIR filter and the one use to obtain the 10 Hz has an order > of 700 (wp = 5 Hz, ws = 10 Hz) !!! > > I am sure there are some more elegant solution.....
Are you saying that you need 2 KHz signals, but your ADC only works up to 2 KHz? That can't be done. The analog input to the ADC must not contain any frequencies as high as half the sample rate? What did you plan to decimate? I don't understand the rest of what you want to do at all. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Jerry Avins <jya@ieee.org> wrote in message news:<406603e3$0$3044$61fed72c@news.rcn.com>...
> seb wrote: > > > Hello, > > > > I am looking for good advices about my design. > > > > I am working with an ADC which work beetween 1kHz and 2kHz but the > > application need data sampled beetween 10 Hz and 2 kHz. So i decide to > > make decimation in order to get the sample frequence beetween 10Hz and > > 1 kHz. But in order to do it in the rigth way i make pre-filtering in > > order to avoid aliasing. > > > > So the decimation factor could be as high as 100 (1kHz to 10 Hz). So i > > need to store 100 FIR filter, one for 2-decimation , one for > > 3-decimation and so on. > > I need 100 FIR filter and the one use to obtain the 10 Hz has an order > > of 700 (wp = 5 Hz, ws = 10 Hz) !!! > > > > I am sure there are some more elegant solution..... > > Are you saying that you need 2 KHz signals, but your ADC only works up > to 2 KHz? That can't be done. The analog input to the ADC must not > contain any frequencies as high as half the sample rate? > > What did you plan to decimate? I don't understand the rest of what you > want to do at all. > > Jerry
Hello, The ADC i use can not sampled below 1 kHz but the application need signal samped for 10 Hz to 2 kHz. So when i need the input signal to be sampled at 1.5 kHz, i need nothing but just configure the ADC to work at 1.5 kHz. However, when i need 500 Hz, i configured the ADC to work at 1 kHz and decimate by 2. When i need 254 Hz, i configured the ADC to work at 1016 Hz and decimate by 4. When i need 11 Hz, i configured the ADC to work at 1100 Hz and decimate by 100. And so on. So i need 100 FIR filter, one for each decimation factor. Think for advices
seb wrote:

> Jerry Avins <jya@ieee.org> wrote in message news:<406603e3$0$3044$61fed72c@news.rcn.com>... > >>seb wrote: >> >> >>>Hello, >>> >>>I am looking for good advices about my design. >>> >>>I am working with an ADC which work beetween 1kHz and 2kHz but the >>>application need data sampled beetween 10 Hz and 2 kHz. So i decide to >>>make decimation in order to get the sample frequence beetween 10Hz and >>>1 kHz. But in order to do it in the rigth way i make pre-filtering in >>>order to avoid aliasing. >>> >>>So the decimation factor could be as high as 100 (1kHz to 10 Hz). So i >>>need to store 100 FIR filter, one for 2-decimation , one for >>>3-decimation and so on. >>>I need 100 FIR filter and the one use to obtain the 10 Hz has an order >>>of 700 (wp = 5 Hz, ws = 10 Hz) !!! >>> >>>I am sure there are some more elegant solution..... >> >>Are you saying that you need 2 KHz signals, but your ADC only works up >>to 2 KHz? That can't be done. The analog input to the ADC must not >>contain any frequencies as high as half the sample rate? >> >>What did you plan to decimate? I don't understand the rest of what you >>want to do at all. >> >>Jerry > > > > Hello, > > The ADC i use can not sampled below 1 kHz but the application need > signal samped for 10 Hz to 2 kHz. So when i need the input signal to > be sampled at 1.5 kHz, i need nothing but just configure the ADC to > work at 1.5 kHz. However, when i need 500 Hz, i configured the ADC to > work at 1 kHz and decimate by 2. When i need 254 Hz, i configured the > ADC to work at 1016 Hz and decimate by 4. When i need 11 Hz, i > configured the ADC to work at 1100 Hz and decimate by 100. And so on. > > So i need 100 FIR filter, one for each decimation factor. > > Think for advices
Seb, I don't know what you want to accomplish, but it's not hard to guess that there might be an easier way to accomplish it. For example, when you need 254 samples per second, you can simply take samples at the 1016 rate and keep only every fourth one without any filter at all. Of course, a waveform that you sample 254 times per second may have no components as high as 508 Hz. If hither frequencies are present, you must either filter them out before hand, or sample at a higher rate and then decimate with filtering. If you describe what you want to do in addition to some of the steps you think you need in doing it, you can get better help. 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;
In article <4066ffe9$0$3040$61fed72c@news.rcn.com>,
Jerry Avins  <jya@ieee.org> wrote:
>, or sample at a higher rate and then decimate with filtering.
That is what it sounds like he wants to do. But his sampling rate is a variable 1X to 100X higher than the data rate he wants. And his comments make it sound like simple subsampling will cause aliasing. Whether he cares about any aliasing in the original sampling is not part of his question. A set of multistage decimating filters of various factors might be a good solution, unless he really needs exact prime number scale factors. IMHO. YMMV. -- Ron Nicholson rhn AT nicholson DOT com http://www.nicholson.com/rhn/ #include <canonical.disclaimer> // only my own opinions, etc.
Ronald H. Nicholson Jr. wrote:

> In article <4066ffe9$0$3040$61fed72c@news.rcn.com>, > Jerry Avins <jya@ieee.org> wrote: > >>, or sample at a higher rate and then decimate with filtering. > > > That is what it sounds like he wants to do. But his sampling rate is a > variable 1X to 100X higher than the data rate he wants. And his comments > make it sound like simple subsampling will cause aliasing. Whether he > cares about any aliasing in the original sampling is not part of his > question. > > A set of multistage decimating filters of various factors might be a > good solution, unless he really needs exact prime number scale factors. > > > IMHO. YMMV.
I can guess several possible scenarios, but if I know what he wants, I can be more specific. There's no point in us conversing with each other. I suspect that his needs can be met with half a dozen filters or fewer. 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;
"seb" <germain1_fr@yahoo.fr> wrote in message
news:23925133.0403271355.72a613f9@posting.google.com...
> Hello, > > I am looking for good advices about my design. > > I am working with an ADC which work beetween 1kHz and 2kHz but the > application need data sampled beetween 10 Hz and 2 kHz. So i decide to > make decimation in order to get the sample frequence beetween 10Hz and > 1 kHz. But in order to do it in the rigth way i make pre-filtering in > order to avoid aliasing. > > So the decimation factor could be as high as 100 (1kHz to 10 Hz). So i > need to store 100 FIR filter, one for 2-decimation , one for > 3-decimation and so on. > I need 100 FIR filter and the one use to obtain the 10 Hz has an order > of 700 (wp = 5 Hz, ws = 10 Hz) !!! > > I am sure there are some more elegant solution.....
Here is a much simpler way to handle your various decimations. You design *one* half band filter. Use this filter for every decimation by 2 step. So if you need a decimation by 8, you'd repeat the decimation by 2 three times using the same filter. You *might* need a 'cleanup' filter at the end of your decimation but I don't know the requirements of your final decimated signal. If there are cases where your decimation isn't a multiple of 2, then you can handle those as special cases and create filters for them. There are possibly even more elegant ways, but without knowing your exact requirements it's hard to provide alternatives. Cheers Bhaskar
Bhaskar Thiagarajan wrote:
> Here is a much simpler way to handle your various decimations. > You design *one* half band filter. Use this filter for every decimation by 2 > step. > So if you need a decimation by 8, you'd repeat the decimation by 2 three > times using the same filter. > You *might* need a 'cleanup' filter at the end of your decimation but I > don't know the requirements of your final decimated signal. > If there are cases where your decimation isn't a multiple of 2, then you can > handle those as special cases and create filters for them. > There are possibly even more elegant ways, but without knowing your exact > requirements it's hard to provide alternatives.
I suppose that having a filter for all the primes less than 100 would treat all the cases. In other words, filters to decimate by 2,3,5,7,11, ... 97. There are only 25 primes less than 100. Then when you want to decimate by N, factor N into primes and decimate by those filters. You could also calculate the required filter coefs on the fly as required, and write a decimator and a coef generator that take N as an argument. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (703) 779-7770 The secret to enjoying your job is to have a hobby that's even worse - Calvin's Dad
Jim Thomas <jthomas@bittware.com> wrote in message news:<106gsa2ifp00642@corp.supernews.com>...
> Bhaskar Thiagarajan wrote: > > Here is a much simpler way to handle your various decimations. > > You design *one* half band filter. Use this filter for every decimation by 2 > > step. > > So if you need a decimation by 8, you'd repeat the decimation by 2 three > > times using the same filter. > > You *might* need a 'cleanup' filter at the end of your decimation but I > > don't know the requirements of your final decimated signal. > > If there are cases where your decimation isn't a multiple of 2, then you can > > handle those as special cases and create filters for them. > > There are possibly even more elegant ways, but without knowing your exact > > requirements it's hard to provide alternatives. > > I suppose that having a filter for all the primes less than 100 would > treat all the cases. In other words, filters to decimate by 2,3,5,7,11, > ... 97. There are only 25 primes less than 100. Then when you want to > decimate by N, factor N into primes and decimate by those filters. >
It is a very good idea.
> You could also calculate the required filter coefs on the fly as > required, and write a decimator and a coef generator that take N as an > argument.
But i am afraid about calculate filter on the fly. I know there is some code to compute equiripple FIR filter (Remez Exchange algorithm) but i do not know if this code is good and not bugged. Think.
Actually, with successive decimation by 2 the earlier filters (which are the
higher rate ones, and therefore the more expensive ones in terms of processing)
can be less stringent.  Goodman and Carey published a paper in the 70's on a set
of halfband decimation filters and a procedure for using them in such a way as
to make the higher rates ones simpler.  We are talking about filters with less
than 19 taps here folks, and half of those taps are 0.  The first filter can be
a simple moving average filter, and in fact for wide decimation ratios, a CIC
filter fits the bill there very nicely.  The advantage of a CIC decimating
filter is that the shape of the filter referred to the output sample rate is
pretty much independent of the decimation ratio for decimation ratios greater
than about 10.

Typically, you'd use a CIC followed possibly by some number of half-band filters
and then a FIR clean-up filter that corrects any 'droop' in the passband and
sharpens up the transition.  the CIC is normally selected to have its first null
at several times the cut-off of the composite filter.  It is a bit tougher when
your minimum decimation is only 2 because of the shape of the CIC.



Bhaskar Thiagarajan wrote:

> "seb" <germain1_fr@yahoo.fr> wrote in message > news:23925133.0403271355.72a613f9@posting.google.com... > > Hello, > > > > I am looking for good advices about my design. > > > > I am working with an ADC which work beetween 1kHz and 2kHz but the > > application need data sampled beetween 10 Hz and 2 kHz. So i decide to > > make decimation in order to get the sample frequence beetween 10Hz and > > 1 kHz. But in order to do it in the rigth way i make pre-filtering in > > order to avoid aliasing. > > > > So the decimation factor could be as high as 100 (1kHz to 10 Hz). So i > > need to store 100 FIR filter, one for 2-decimation , one for > > 3-decimation and so on. > > I need 100 FIR filter and the one use to obtain the 10 Hz has an order > > of 700 (wp = 5 Hz, ws = 10 Hz) !!! > > > > I am sure there are some more elegant solution..... > > Here is a much simpler way to handle your various decimations. > You design *one* half band filter. Use this filter for every decimation by 2 > step. > So if you need a decimation by 8, you'd repeat the decimation by 2 three > times using the same filter. > You *might* need a 'cleanup' filter at the end of your decimation but I > don't know the requirements of your final decimated signal. > If there are cases where your decimation isn't a multiple of 2, then you can > handle those as special cases and create filters for them. > There are possibly even more elegant ways, but without knowing your exact > requirements it's hard to provide alternatives. > > Cheers > Bhaskar
-- --Ray Andraka, P.E. President, the Andraka Consulting Group, Inc. 401/884-7930 Fax 401/884-7950 email ray@andraka.com http://www.andraka.com "They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin, 1759