Polyphase decimation

Started by Praveen November 18, 2005
Hi

I am implementing a polyphase decimation of a 8k signal by a factor of
20.  I have designed a filter of pi/20, which means there are 20
subbands.  In case of decimation, the input gets shifted by a sample at
each time instant and then convolved with all the filters accordingly,
and finally summed from all the subbands to give the output.  And
finally 19 out of 20 samples are thrown out.  Am I right in my
implementation?

I am implementing this in Matlab.  Any help will be appreciated.
Thanks!

Rgds,
Praveen

Praveen wrote:

> Hi > > I am implementing a polyphase decimation of a 8k signal by a factor of > 20. I have designed a filter of pi/20, which means there are 20 > subbands. In case of decimation, the input gets shifted by a sample at > each time instant and then convolved with all the filters accordingly, > and finally summed from all the subbands to give the output. And > finally 19 out of 20 samples are thrown out. Am I right in my > implementation?
That will work, but it can be done much efficiently. The purpose of polyphase is that you can move the decimation in front of the filters, so that you can filter at lower samplerate. This http://cnx.rice.edu/content/m10433/latest/m10433fig2.png is how you do it now, correct? Filters are H0(z^M) to H{M-1}(z^M). z^M means that the impulse response has zeros between the samples. This sparseness allows you to move the downsampling in front of every filter (not in front of the delays). If you do this, you have to change your filters to H0(z), so that the impulse responses are dense (no extra zeros). -- Jani Huhtanen Tampere University of Technology, Pori
so now whats the best way of doing it? Can you guide me to a suitable
literature?

Praveen wrote:

> so now whats the best way of doing it? Can you guide me to a suitable > literature?
IIRC this is pretty good book about the subject: Multiresolution signal decomposition transforms, subbands and wavelets Akansu, Ali N. But you're almost there already. You only need to get rid of the zeros in the filters H0 to H{M-1} and move the decimation in front of the filters. Otherwise the structure remains the same. In practice this means that only every Mth sample is filtered through any given filter. H0 filters sample n, H1 filters sample n-1, H{M-1} filters the sample n-M+1. And at the next "tick" H0 filters the sample n+M, H1 n+M-1, and so on. -- Jani Huhtanen Tampere University of Technology, Pori
Praveen wrote:
> Hi > > I am implementing a polyphase decimation of a 8k signal by a factor of > 20. I have designed a filter of pi/20, which means there are 20 > subbands. In case of decimation, the input gets shifted by a sample at > each time instant and then convolved with all the filters accordingly, > and finally summed from all the subbands to give the output. And > finally 19 out of 20 samples are thrown out. Am I right in my > implementation? > > I am implementing this in Matlab. Any help will be appreciated. > Thanks! > > Rgds, > Praveen >
Just use the Matlab function "resample". It does what you want. OUP
I dont want to simulate using Matlab function resample since I wouldnt
get to know the polyphase implementation.
Is it something like this...

Let us say I have a set of samples...x = [1:1:100]
h = [1:1:100]
Let us say my sampling rate is 4
h0 = [1 0 0 0 5 0 0 0 9....]
h1 = [2 0 0 0 6 0 0 0 10...]
h2 = [3....
h3 = [4...

Similarly my x0 would be [1 5 9..]
x1 = [2 6 10..]
x2 = [3 7 11...]
x3 = [4 8 12...]
I would multiply x and h in the corresponding subbands to get the
decimated output..Am i Right?

Praveen wrote:

> I dont want to simulate using Matlab function resample since I wouldnt > get to know the polyphase implementation. > Is it something like this... > > Let us say I have a set of samples...x = [1:1:100] > h = [1:1:100] > Let us say my sampling rate is 4 > h0 = [1 0 0 0 5 0 0 0 9....] > h1 = [2 0 0 0 6 0 0 0 10...] > h2 = [3.... > h3 = [4... > > Similarly my x0 would be [1 5 9..] > x1 = [2 6 10..] > x2 = [3 7 11...] > x3 = [4 8 12...] > I would multiply x and h in the corresponding subbands to get the > decimated output..Am i Right?
With those filters (h0 to h3) you should have only delayed signals. ie. x0 = [1 2 3 4..] x1 = [0 1 2 3..] x2 = [0 0 1 2..] x3 = [0 0 0 1..] Then you would convolve x0 with h0, x1 with h1 and so on. After that you would sum the resulting vectors and downsample with four (ie. discard all but every fourth sample). If you would do like I suggested then your x0 to x3 are correct (they are already delayed and downsampled) but your filters should be: h0 = [1 5 9..] h1 = [2 6 10..] h2 = [3 7 11..] h3 = [4 8 12..], (ie. zeros removed) Now you would again convolve h0 with x0 and so on and sum the results, but now this time there would be no need for downsampling because it's already done before the convolution. -- ---- Jani Huhtanen Tampere University of Technology, Pori
Praveen wrote:

> I dont want to simulate using Matlab function resample since I wouldnt > get to know the polyphase implementation. > Is it something like this... > > Let us say I have a set of samples...x = [1:1:100] > h = [1:1:100] > Let us say my sampling rate is 4 > h0 = [1 0 0 0 5 0 0 0 9....] > h1 = [2 0 0 0 6 0 0 0 10...] > h2 = [3.... > h3 = [4... > > Similarly my x0 would be [1 5 9..] > x1 = [2 6 10..] > x2 = [3 7 11...] > x3 = [4 8 12...] > I would multiply x and h in the corresponding subbands to get the > decimated output..Am i Right?
With those filters (h0 to h3) you should have only delayed signals. ie. x0 = [1 2 3 4..] x1 = [0 1 2 3..] x2 = [0 0 1 2..] x3 = [0 0 0 1..] Then you would convolve x0 with h0, x1 with h1 and so on. After that you would sum the resulting vectors and downsample with four (ie. discard all but every fourth sample). If you would do like I suggested then your x0 to x3 are correct (they are already delayed and downsampled) but your filters should be: h0 = [1 5 9..] h1 = [2 6 10..] h2 = [3 7 11..] h3 = [4 8 12..], (ie. zeros removed) Now you would again convolve h0 with x0 and so on and sum the results, but now this time there would be no need for downsampling because it's already done before the convolution. -- ---- Jani Huhtanen Tampere University of Technology, Pori
I dont want to simulate using Matlab function resample since I wouldnt
get to know the polyphase implementation.
Is it something like this...

Let us say I have a set of samples...x = [1:1:100]
h = [1:1:100]
Let us say my sampling rate is 4
h0 = [1 0 0 0 5 0 0 0 9....]
h1 = [2 0 0 0 6 0 0 0 10...]
h2 = [3....
h3 = [4...

Similarly my x0 would be [1 5 9..]
x1 = [2 6 10..]
x2 = [3 7 11...]
x3 = [4 8 12...]
I would multiply x and h in the corresponding subbands to get the
decimated output..Am i Right?

Praveen wrote:
> Hi > > I am implementing a polyphase decimation of a 8k signal by a factor of > 20. I have designed a filter of pi/20, which means there are 20 > subbands. In case of decimation, the input gets shifted by a sample at > each time instant and then convolved with all the filters accordingly, > and finally summed from all the subbands to give the output. And > finally 19 out of 20 samples are thrown out. Am I right in my > implementation? > > I am implementing this in Matlab. Any help will be appreciated. > Thanks! > > Rgds, > Praveen >
Just use the Matlab function "resample". It does what you want. OUP
Praveen wrote:

> so now whats the best way of doing it? Can you guide me to a suitable > literature?
IIRC this is pretty good book about the subject: Multiresolution signal decomposition transforms, subbands and wavelets Akansu, Ali N. But you're almost there already. You only need to get rid of the zeros in the filters H0 to H{M-1} and move the decimation in front of the filters. Otherwise the structure remains the same. In practice this means that only every Mth sample is filtered through any given filter. H0 filters sample n, H1 filters sample n-1, H{M-1} filters the sample n-M+1. And at the next "tick" H0 filters the sample n+M, H1 n+M-1, and so on. -- Jani Huhtanen Tampere University of Technology, Pori
so now whats the best way of doing it? Can you guide me to a suitable
literature?

Praveen wrote:

> Hi > > I am implementing a polyphase decimation of a 8k signal by a factor of > 20. I have designed a filter of pi/20, which means there are 20 > subbands. In case of decimation, the input gets shifted by a sample at > each time instant and then convolved with all the filters accordingly, > and finally summed from all the subbands to give the output. And > finally 19 out of 20 samples are thrown out. Am I right in my > implementation?
That will work, but it can be done much efficiently. The purpose of polyphase is that you can move the decimation in front of the filters, so that you can filter at lower samplerate. This http://cnx.rice.edu/content/m10433/latest/m10433fig2.png is how you do it now, correct? Filters are H0(z^M) to H{M-1}(z^M). z^M means that the impulse response has zeros between the samples. This sparseness allows you to move the downsampling in front of every filter (not in front of the delays). If you do this, you have to change your filters to H0(z), so that the impulse responses are dense (no extra zeros). -- Jani Huhtanen Tampere University of Technology, Pori
Hi

I am implementing a polyphase decimation of a 8k signal by a factor of
20.  I have designed a filter of pi/20, which means there are 20
subbands.  In case of decimation, the input gets shifted by a sample at
each time instant and then convolved with all the filters accordingly,
and finally summed from all the subbands to give the output.  And
finally 19 out of 20 samples are thrown out.  Am I right in my
implementation?

I am implementing this in Matlab.  Any help will be appreciated.
Thanks!

Rgds,
Praveen