View Single Post
  #21 (permalink)  
Old 12-17-2004, 06:22 AM
Randy Yates
Guest
 
Posts: n/a
Default Re: Sample Rate Conversion (Downsampling)

Jim Thomas <[email protected]> writes:

> Randy Yates wrote:
> [snip]
>> It's almost a matter of how you write it. The linear convolution is
>> y[n] = x[n*M + 0*M - 0] * h[ 0*M + 0] + x[n*M + 0*M - 1]
>> * h[ 0*M + 1] + ... + x[n*M + 0*M - (M-1)] * h[ 0*M +
>> (M-1)]
>> + x[n*M + 1*M - 0] * h[ 1*M + 0] + x[n*M + 1*M - 1] * h[ 1*M + 1] + ... + x[n*M + 1*M - (M-1)] * h[ 1*M + (M-1)]
>> + ...
>> + x[n*M + (K-1)*M - 0] * h[(K-1)*M + 0] + x[n*M + (K-1)*M - 1] * h[(K-1)*M + 1] + ... + x[n*M + (K-1)*M - (M-1)] * h[(K-1)*M + (M-1)]
>> To get the "polyphase" version just look at this column-wise instead
>> of row-wise.

>
> I think I see where you're going with this, but I still have
> questions. In order to get my brain wrapped around this equation I
> had to plug in some real numbers. I chose M=3 and K=3. Unless I made
> a tragic error, the above reduces to:
>
> y[n] = x[n*3 + 0] * h[0] + x[n*3 - 1] * h[1] + x[n*3 - 2] * h[2]
> + x[n*3 + 3] * h[3] + x[n*3 + 2] * h[4] + x[n*3 + 1] * h[5]
> + x[n*3 + 6] * h[6] + x[n*3 + 5] * h[7] + x[n*3 + 4] * h[8]
>
> Still having trouble, so I plug in n=0 and try again:
> y[0] = x[ 0] * h[0] + x[-1] * h[1] + x[-2] * h[2]
> + x[ 3] * h[3] + x[ 2] * h[4] + x[ 1] * h[5]
> + x[ 6] * h[6] + x[ 5] * h[7] + x[ 4] * h[8]
>
> and again, with n=1:
> y[1] = x[3] * h[0] + x[2] * h[1] + x[1] * h[2]
> + x[6] * h[3] + x[5] * h[4] + x[4] * h[5]
> + x[9] * h[6] + x[8] * h[7] + x[7] * h[8]
>
> It looks to me like x needs both its rows and columns swapped. I'd be
> a lot happier if I ended up with something like this:
>
> y[1] = x[9] * h[0] + x[8] * h[1] + x[7] * h[2]
> + x[6] * h[3] + x[5] * h[4] + x[4] * h[5]
> + x[3] * h[6] + x[2] * h[7] + x[1] * h[8]
>
> Again, I'm allowing ample room for the possibility that I'm wrong, so
> don't be shy! Is your equation correct?


Nope! You're right. I had a sign problem in the x's. This corrects that problem (hopefully
there are no others!):

y[n] = x[n*M - 0*M - 0] * h[ 0*M + 0] + x[n*M - 0*M - 1] * h[ 0*M + 1] + ... + x[n*M - 0*M - (M-1)] * h[ 0*M + (M-1)]
+ x[n*M - 1*M - 0] * h[ 1*M + 0] + x[n*M - 1*M - 1] * h[ 1*M + 1] + ... + x[n*M - 1*M - (M-1)] * h[ 1*M + (M-1)]
+ ...
+ x[n*M - (K-1)*M - 0] * h[(K-1)*M + 0] + x[n*M - (K-1)*M - 1] * h[(K-1)*M + 1] + ... + x[n*M - (K-1)*M - (M-1)] * h[(K-1)*M + (M-1)]

Thanks for the correction, Jim.
--
% Randy Yates % "Maybe one day I'll feel her cold embrace,
%% Fuquay-Varina, NC % and kiss her interface,
%%% 919-577-9882 % til then, I'll leave her alone."
%%%% <[email protected]> % 'Yours Truly, 2095', *Time*, ELO
http://home.earthlink.net/~yatescr
Reply With Quote