View Single Post
  #5 (permalink)  
Old 03-06-2007, 07:08 PM
[email protected]
Guest
 
Posts: n/a
Default Re: Time domain convolution in a real-time situation


> By causal I am assuming I should take the input signal "as is"?


By causal, I meant that the signal is zero for all instances of time
before time zero.

> Here's how I do it now:
>
> - I add zeroes (number = length of H[]) at the beginning and end of
> X[].
>
> - I have changed the original algorithm to:
>
> if j-i < 0 then
> Y[j] := Y[j] + Tx[i] * H[i]
> else
> Y[j] := Y[j] + Tx[j-i] * H[i];
>
> Y[] now becomes something like:http://users.pandora.be/dirk.claesse...bandfilter.JPG


Explicitly padding the input signal with zeros like this will work.
However, note that you're essentially delaying the input signal by
length(H) samples, so your output signal (even before you see any
transients) will also be delayed by length(H) samples.

> My problem now was, which part of Y[] should I extract and use?
> After much and trial & error and some hair-pulling, I finally found a
> intuitive solution that actually works:


-snipped-

I forgot to ask before: why do you want to discard the transients? The
filter "startup" time is valid data, and occurs as your input signal
gradually fills up the delay lines that feed each filter tap. If you
don't want to see any of the startup transients, then you would just
have to discard all of the samples before all of the filter's taps
have been filled. This doesn't occur until length(H) input samples
have entered the filter. You'll also see the same effect on the way
out; after your input signal ends (and you start passing the zeros
that you padded onto the end into the filter), you'll have length(H)
instances of time where some of the input data stored in the filter's
delay lines are the zeros that you used for padding. If you're doing
the filtering on a block basis and you're going to continue to feed
the filter with new data as time goes on, then you need to maintain
these transients to get correct results.

Remember, all you're trying to do here is implement the convolution
sum, nothing more. The process of convolution causes the transients to
appear, and they are a valid part of its output.

Jason


Reply With Quote