DSPRelated.com
Forums

Filterting a complex sequence

Started by Unknown October 11, 2007
I have a complex sequence with 1 million elements. I have filter five
low pass filter coefficients a and b respectively.  To filter the
complex sequence X - in matlab I execute the filter function.  So now:

xtd = filter (b,a, X);

At issue:  I'm having difficulty achieving the same result when I
'break' the complex sequence X in 4 sequences.  In other words, I take
N elements  ( 1 million ) divide them by 4, then perform the filter
operation on the reduced elements.  Each result from the reduced
sequence is integrated to form produce a final sequence.  Logic seems
to suggest that 4 operations on a reduced sequence would not provide
the same result on one operation on 1 sequence.  Trouble is, I'm
hearing the operation might be tricky but 'doable' (no concrete
solution, just ..well it should be 'doable').   The question.  If this
is possible, any tips ideas on achieving my objective would be greatly
appreciated?

NOTE:  I'm too old to be in school, so this is not a homework
problem.  That said, I'm just reading a host of DSP books/tutorials/
etc trying to become more acclimated with signal processing.

Thanks

On Oct 11, 12:25 pm, forums...@hotmail.com wrote:
> I have a complex sequence with 1 million elements. I have filter five > low pass filter coefficients a and b respectively. To filter the > complex sequence X - in matlab I execute the filter function. So now: > > xtd = filter (b,a, X); > > At issue: I'm having difficulty achieving the same result when I > 'break' the complex sequence X in 4 sequences. In other words, I take > N elements ( 1 million ) divide them by 4, then perform the filter > operation on the reduced elements. Each result from the reduced > sequence is integrated to form produce a final sequence. Logic seems > to suggest that 4 operations on a reduced sequence would not provide > the same result on one operation on 1 sequence. Trouble is, I'm > hearing the operation might be tricky but 'doable' (no concrete > solution, just ..well it should be 'doable'). The question. If this > is possible, any tips ideas on achieving my objective would be greatly > appreciated? > > NOTE: I'm too old to be in school, so this is not a homework > problem. That said, I'm just reading a host of DSP books/tutorials/ > etc trying to become more acclimated with signal processing. > > Thanks
You can do the filtering in blocks of samples that are smaller than your whole dataset. However, you have to ensure that between blocks, you maintain the state of the filter's delay lines (i.e. the filter needs the last M samples of the previous block for an Mth order filter). Otherwise, you don't get an equivalent operation when you concatenate the output blocks. A typical DSP implementation would probably work this way anyway; you often don't know when the end of your data will be, so you process it in blocks as samples become available. In MATLAB, you can specify the initial states of the delay lines using the 4-argument version of the filter() function. Jason
On Oct 11, 9:25 am, forums...@hotmail.com wrote:
> I have a complex sequence with 1 million elements. I have filter five > low pass filter coefficients a and b respectively. To filter the > complex sequence X - in matlab I execute the filter function. So now: > > xtd = filter (b,a, X); > > At issue: I'm having difficulty achieving the same result when I > 'break' the complex sequence X in 4 sequences. In other words, I take > N elements ( 1 million ) divide them by 4, then perform the filter > operation on the reduced elements. Each result from the reduced > sequence is integrated to form produce a final sequence. Logic seems > to suggest that 4 operations on a reduced sequence would not provide > the same result on one operation on 1 sequence. Trouble is, I'm > hearing the operation might be tricky but 'doable' (no concrete > solution, just ..well it should be 'doable'). The question. If this > is possible, any tips ideas on achieving my objective would be greatly > appreciated? > > NOTE: I'm too old to be in school, so this is not a homework > problem. That said, I'm just reading a host of DSP books/tutorials/ > etc trying to become more acclimated with signal processing. > > Thanks
As mentioned in the post by Jason, but with an example... Let's assume an FIR filter and hopefully, given the code that you posted, you're working in Matlab. b=[1,2,3,4,5] % filter coefficients a=1; X=complex(randn(1,100),randn(1,100)); % generate some random complex data you have 1e6 % now process in blocks of 25 samples each Nseq = 4; lenseq = length(X)/Nseq; zi=zeros(max(length(a),length(b))-1,1); for i=1:Nseq index = (i-1)*lenseq+1:i*lenseq; xin = X(index); [yseq(index),zf] = filter(b,a,xin,zi) zi = zf; end % compare the result yseq with the following y = filter(b,a,X); you have just got to watch the tails of the filter response, that's all. col
On 11 Okt, 18:25, forums...@hotmail.com wrote:
> I have a complex sequence with 1 million elements. I have filter five > low pass filter coefficients a and b respectively. To filter the > complex sequence X - in matlab I execute the filter function. So now: > > xtd = filter (b,a, X); > > At issue: I'm having difficulty achieving the same result when I > 'break' the complex sequence X in 4 sequences. In other words, I take > N elements ( 1 million ) divide them by 4, then perform the filter > operation on the reduced elements. Each result from the reduced > sequence is integrated to form produce a final sequence. Logic seems > to suggest that 4 operations on a reduced sequence would not provide > the same result on one operation on 1 sequence. Trouble is, I'm > hearing the operation might be tricky but 'doable' (no concrete > solution, just ..well it should be 'doable'). The question. If this > is possible, any tips ideas on achieving my objective would be greatly > appreciated?
Eh... what is the application? Why do you choose this elaborate procedure? Even if the coefficients are complex-valued, 1M samples isn't a lot of data. On a decent computer a straight-forward implementation ought to be no problem. I don't know if numerical accuracy would kill it, but a 1M FFT with a filter implemented in frequency domain ought to be feasible as well. Rune