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

On Mar 6, 6:01 am, DSP-Newbie <N...@way.invalid> wrote:
> Hi group,
>
> I'm still working on my software BFSK-modem project.
> More specifically, i want to use better filters, so I'm experimenting
> with a windowed sinc filter (Blackman window).
> I can succesfully calculate the impulse response H[]
>
> My problem is that when I apply the filtering algorithm ( as found in
> ch. 16 of The Scientist & Engineer's Guide to DSP ) , that the first M
> output datapoints in Y[] are zero. ( M = length of H[] )
>
> Quote example code:
> N=4999, M=100
>
> for j := 100 to 4999 do
> begin
> Y[j] := 0;
> for i:= 0 to 100 do
> Y[j] := Y[j] + X[j-i] * H[i];
> end;
>
> If this were only a transient startup effect, it wouldn't be a problem,
> but if I apply the algorithm on each incoming datablock, then I will
> obviously "loose" data.
>
> I understand why the first M points must be zero in a "statical"
> situation, but can't figure out how to handle this in a real-time
> environment, so that I get a continuous filtered output.
>
> I have read about OLA/OLS, but all examples seemed to apply only to FFT
> filters.
>
> Please bear with me, my mathematical background leaves a lot to be
> desired :0(


The comment given at the top of the table that this code came out of
says:

"This program filters 5000 samples with a 101 point windowed-sinc
filter, resulting in 4900 samples of filtered data."

This statement tells you that the author is choosing to overlook the
transients that would occur at the start and end of the output. In
general, if you convolve an M length sequence with an N length
sequence, the output will have length M + N - 1. The author in this
case has ignored the data that would occur on the edges and just
returns the non-transient portion of the output sequence.

The fact that the start of the sequence is ignored is shown by the
fact that the loop index j (which indexes the output array) starts at
100; no values are loaded into the output array Y for indices smaller
than 100. You could certainly change the code to calculate the entire
sequence, starting at index 0, but you would need some additional
logic to handle this case, as in these cases you will not have enough
input samples to evaluate every term of the sum. You would probably
instead assume that the input signal is causal and is therefore zero
for indices less than zero.

Jason

Reply With Quote