DSPRelated.com
Forums

How to account for filter delay

Started by vasindagi June 28, 2008
Hi all,

Its known that the delay for a FIR filter is (N-1)/2  where N is the
length of the filter and the filter is symmetric.

I am supposed to calculate the Mean Square Error between the input and
output of the filter. Since the length of the output will be greater than
the length of the input, I wanted to know how to relate the output of the
filter to the input of the filter.
i.e., if x(n) is the input
         y(n) is the ouput
         length of the filter is N
         length(x) = L
         length(y) = L+N-1
         therefore, length(y) > length(x)
But to calculate the mean square error the lengths of the 2 sequences has
to be equal. So how do I take into account the delay caused by the fir
filter.

Thanks.

vasindagi wrote:
> Hi all, > > Its known that the delay for a FIR filter is (N-1)/2 where N is the > length of the filter and the filter is symmetric. > > I am supposed to calculate the Mean Square Error between the input and > output of the filter. Since the length of the output will be greater than > the length of the input, I wanted to know how to relate the output of the > filter to the input of the filter. > i.e., if x(n) is the input > y(n) is the ouput > length of the filter is N > length(x) = L > length(y) = L+N-1 > therefore, length(y) > length(x) > But to calculate the mean square error the lengths of the 2 sequences has > to be equal. So how do I take into account the delay caused by the fir > filter.
If the filter does something useful (i.e., the output differs from the input) what soes "error" signify? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
>vasindagi wrote: >> Hi all, >> >> Its known that the delay for a FIR filter is (N-1)/2 where N is the >> length of the filter and the filter is symmetric. >> >> I am supposed to calculate the Mean Square Error between the input and >> output of the filter. Since the length of the output will be greater
than
>> the length of the input, I wanted to know how to relate the output of
the
>> filter to the input of the filter. >> i.e., if x(n) is the input >> y(n) is the ouput >> length of the filter is N >> length(x) = L >> length(y) = L+N-1 >> therefore, length(y) > length(x) >> But to calculate the mean square error the lengths of the 2 sequences
has
>> to be equal. So how do I take into account the delay caused by the fir >> filter. > >If the filter does something useful (i.e., the output differs from the >input) what soes "error" signify? > >Jerry >-- >Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� >
Hi Jerry, In my case, the output of the filter is the signal reconstructed using QMF filters. That is the input is first split into 2 bands and then combined using QMF filters. Obviously in this process there will be some error due to aliasing if the filters used are not brick wall (for lower filter lengths). I want to measure this error for which I m using Mean Square Error.
On Jun 28, 1:33&#4294967295;am, "vasindagi" <vish...@gmail.com> wrote:
> Hi all, > > Its known that the delay for a FIR filter is (N-1)/2 &#4294967295;where N is the > length of the filter and the filter is symmetric. > > I am supposed to calculate the Mean Square Error between the input and > output of the filter. Since the length of the output will be greater than > the length of the input, I wanted to know how to relate the output of the > filter to the input of the filter. > i.e., if x(n) is the input > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;y(n) is the ouput > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;length of the filter is N > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;length(x) = L > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;length(y) = L+N-1 > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295;therefore, length(y) > length(x) > But to calculate the mean square error the lengths of the 2 sequences has > to be equal. So how do I take into account the delay caused by the fir > filter.
Line up the two sequences using an offset equal to the filter delay, and then window both sequences in the intersecting subset, and maybe delayed to after the filter's impulse response settles, depending on what you want to measure. . IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
vasindagi wrote:
>> vasindagi wrote: >>> Hi all, >>> >>> Its known that the delay for a FIR filter is (N-1)/2 where N is the >>> length of the filter and the filter is symmetric. >>> >>> I am supposed to calculate the Mean Square Error between the input and >>> output of the filter. Since the length of the output will be greater > than >>> the length of the input, I wanted to know how to relate the output of > the >>> filter to the input of the filter. >>> i.e., if x(n) is the input >>> y(n) is the ouput >>> length of the filter is N >>> length(x) = L >>> length(y) = L+N-1 >>> therefore, length(y) > length(x) >>> But to calculate the mean square error the lengths of the 2 sequences > has >>> to be equal. So how do I take into account the delay caused by the fir >>> filter. >> If the filter does something useful (i.e., the output differs from the >> input) what soes "error" signify? >> >> Jerry > > Hi Jerry, > In my case, the output of the filter is the signal reconstructed using QMF > filters. That is the input is first split into 2 bands and then combined > using QMF filters. Obviously in this process there will be some error due > to aliasing if the filters used are not brick wall (for lower filter > lengths). I want to measure this error for which I m using Mean Square > Error.
A test scenario in which the only operation on the separate parts is recombining them can be useful, but only to test the separation and recombination part of the code. Is that what you want? Altering the filtered signal in some way, such as clipping the bands separately and removing generated out-of-band components, makes sense, but then the test does not. Make sure that your separation filters all have the same (odd) number of taps (N), and hence the same integer delay. Make another "filter" of such length that the output is the input delayed by (N+1)/2 + the delay of the recombination process. It is called a delay line, and all coefficients are zero except for the one that is unity. Compare the output of the delay line to the reconstituted signal *after N outputs* have gone by. Jerry -- Engineering is the art of making what you want from things you can get.
>vasindagi wrote: >>> vasindagi wrote: >>>> Hi all, >>>> >>>> Its known that the delay for a FIR filter is (N-1)/2 where N is the >>>> length of the filter and the filter is symmetric. >>>> >>>> I am supposed to calculate the Mean Square Error between the input
and
>>>> output of the filter. Since the length of the output will be greater >> than >>>> the length of the input, I wanted to know how to relate the output
of
>> the >>>> filter to the input of the filter. >>>> i.e., if x(n) is the input >>>> y(n) is the ouput >>>> length of the filter is N >>>> length(x) = L >>>> length(y) = L+N-1 >>>> therefore, length(y) > length(x) >>>> But to calculate the mean square error the lengths of the 2
sequences
>> has >>>> to be equal. So how do I take into account the delay caused by the
fir
>>>> filter. >>> If the filter does something useful (i.e., the output differs from the
>>> input) what soes "error" signify? >>> >>> Jerry >> >> Hi Jerry, >> In my case, the output of the filter is the signal reconstructed using
QMF
>> filters. That is the input is first split into 2 bands and then
combined
>> using QMF filters. Obviously in this process there will be some error
due
>> to aliasing if the filters used are not brick wall (for lower filter >> lengths). I want to measure this error for which I m using Mean Square >> Error. > >A test scenario in which the only operation on the separate parts is >recombining them can be useful, but only to test the separation and >recombination part of the code. Is that what you want? Altering the >filtered signal in some way, such as clipping the bands separately and >removing generated out-of-band components, makes sense, but then the >test does not. > >Make sure that your separation filters all have the same (odd) number of
>taps (N), and hence the same integer delay. Make another "filter" of >such length that the output is the input delayed by (N+1)/2 + the delay >of the recombination process. It is called a delay line, and all >coefficients are zero except for the one that is unity. Compare the >output of the delay line to the reconstituted signal *after N outputs* >have gone by. > >Jerry >-- >Engineering is the art of making what you want from things you can get. >
Hi Jerry, I was splitting the input signal into two bands and then was down quantizing the higher frequency band and then recombining. This resulted in a high frequency noise in the reconstructed signal. So I removed the quantization to check out why the high freq noise was occuring. Thats when I realized that it was happening because of aliasing since the filter length I was using was very low and it dint have the near ideal characterstics. When I started increasing the filter length the noise started reducing. Hence, right now I m just splitting the input and then recombining the splitted signals. Thanks for suggesting the method to delay the input.
vasindagi wrote:
>> vasindagi wrote: >>>> vasindagi wrote: >>>>> Hi all, >>>>> >>>>> Its known that the delay for a FIR filter is (N-1)/2 where N is the >>>>> length of the filter and the filter is symmetric. >>>>> >>>>> I am supposed to calculate the Mean Square Error between the input > and >>>>> output of the filter. Since the length of the output will be greater >>> than >>>>> the length of the input, I wanted to know how to relate the output > of >>> the >>>>> filter to the input of the filter. >>>>> i.e., if x(n) is the input >>>>> y(n) is the ouput >>>>> length of the filter is N >>>>> length(x) = L >>>>> length(y) = L+N-1 >>>>> therefore, length(y) > length(x) >>>>> But to calculate the mean square error the lengths of the 2 > sequences >>> has >>>>> to be equal. So how do I take into account the delay caused by the > fir >>>>> filter. >>>> If the filter does something useful (i.e., the output differs from the > >>>> input) what soes "error" signify? >>>> >>>> Jerry >>> Hi Jerry, >>> In my case, the output of the filter is the signal reconstructed using > QMF >>> filters. That is the input is first split into 2 bands and then > combined >>> using QMF filters. Obviously in this process there will be some error > due >>> to aliasing if the filters used are not brick wall (for lower filter >>> lengths). I want to measure this error for which I m using Mean Square >>> Error. >> A test scenario in which the only operation on the separate parts is >> recombining them can be useful, but only to test the separation and >> recombination part of the code. Is that what you want? Altering the >> filtered signal in some way, such as clipping the bands separately and >> removing generated out-of-band components, makes sense, but then the >> test does not. >> >> Make sure that your separation filters all have the same (odd) number of > >> taps (N), and hence the same integer delay. Make another "filter" of >> such length that the output is the input delayed by (N+1)/2 + the delay >> of the recombination process. It is called a delay line, and all >> coefficients are zero except for the one that is unity. Compare the >> output of the delay line to the reconstituted signal *after N outputs* >> have gone by. >> >> Jerry >> -- >> Engineering is the art of making what you want from things you can get. >> > > > Hi Jerry, > I was splitting the input signal into two bands and then was down > quantizing the higher frequency band and then recombining. This resulted in > a high frequency noise in the reconstructed signal. So I removed the > quantization to check out why the high freq noise was occuring. Thats when > I realized that it was happening because of aliasing since the filter > length I was using was very low and it dint have the near ideal > characterstics. When I started increasing the filter length the noise > started reducing. > Hence, right now I m just splitting the input and then recombining the > splitted signals. > > Thanks for suggesting the method to delay the input.
Something is going on here that I don't understand. Before a signal can downsampled, a low-pass filter is needed to remove the higher frequencies that would otherwise alias. High frequencies need high sampling rates. You could downsample the lower band, but not the higher. Two signals with different sample rates can't be digitally combined without first making their sample rates equal. As I wrote above, I don't understand. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
>vasindagi wrote: >>> vasindagi wrote: >>>>> vasindagi wrote: >>>>>> Hi all, >>>>>> >>>>>> Its known that the delay for a FIR filter is (N-1)/2 where N is
the
>>>>>> length of the filter and the filter is symmetric. >>>>>> >>>>>> I am supposed to calculate the Mean Square Error between the input >> and >>>>>> output of the filter. Since the length of the output will be
greater
>>>> than >>>>>> the length of the input, I wanted to know how to relate the output >> of >>>> the >>>>>> filter to the input of the filter. >>>>>> i.e., if x(n) is the input >>>>>> y(n) is the ouput >>>>>> length of the filter is N >>>>>> length(x) = L >>>>>> length(y) = L+N-1 >>>>>> therefore, length(y) > length(x) >>>>>> But to calculate the mean square error the lengths of the 2 >> sequences >>>> has >>>>>> to be equal. So how do I take into account the delay caused by the >> fir >>>>>> filter. >>>>> If the filter does something useful (i.e., the output differs from
the
>> >>>>> input) what soes "error" signify? >>>>> >>>>> Jerry >>>> Hi Jerry, >>>> In my case, the output of the filter is the signal reconstructed
using
>> QMF >>>> filters. That is the input is first split into 2 bands and then >> combined >>>> using QMF filters. Obviously in this process there will be some
error
>> due >>>> to aliasing if the filters used are not brick wall (for lower filter >>>> lengths). I want to measure this error for which I m using Mean
Square
>>>> Error. >>> A test scenario in which the only operation on the separate parts is >>> recombining them can be useful, but only to test the separation and >>> recombination part of the code. Is that what you want? Altering the >>> filtered signal in some way, such as clipping the bands separately and
>>> removing generated out-of-band components, makes sense, but then the >>> test does not. >>> >>> Make sure that your separation filters all have the same (odd) number
of
>> >>> taps (N), and hence the same integer delay. Make another "filter" of >>> such length that the output is the input delayed by (N+1)/2 + the
delay
>>> of the recombination process. It is called a delay line, and all >>> coefficients are zero except for the one that is unity. Compare the >>> output of the delay line to the reconstituted signal *after N outputs*
>>> have gone by. >>> >>> Jerry >>> -- >>> Engineering is the art of making what you want from things you can
get.
>>> >> >> >> Hi Jerry, >> I was splitting the input signal into two bands and then was down >> quantizing the higher frequency band and then recombining. This
resulted in
>> a high frequency noise in the reconstructed signal. So I removed the >> quantization to check out why the high freq noise was occuring. Thats
when
>> I realized that it was happening because of aliasing since the filter >> length I was using was very low and it dint have the near ideal >> characterstics. When I started increasing the filter length the noise >> started reducing. >> Hence, right now I m just splitting the input and then recombining the >> splitted signals. >> >> Thanks for suggesting the method to delay the input. > >Something is going on here that I don't understand. Before a signal can >downsampled, a low-pass filter is needed to remove the higher >frequencies that would otherwise alias. High frequencies need high >sampling rates. You could downsample the lower band, but not the higher.
>Two signals with different sample rates can't be digitally combined >without first making their sample rates equal. As I wrote above, I don't
>understand. > >Jerry >-- >Engineering is the art of making what you want from things you can get. >&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533; >
Hi Jerry, Let me make it clear. As you told I have used filters before downsampling. I ll explain what is happening. 1. Let x(n) be the input. 2. x(n) is input to two filters (i) Low Pass Filter: whose output includes only low frequencies. (ii)High Pass Filter: whose output includes only high frequencies. 3. The output of the filters are sent to downsamlpers which reduce the sampling rate to fs/2. So we have two channels now the low freq channel and the high freq channel. Since human ears are less sensitive to high frequencies, I down quantize (not downsample as you said) the high freq channel to reduce the bitrate. This was the splitting part. Next comes the reconstruction part. 4. I upsample the two channels (high freq channel and low freq channel) which gives 2 channels of sampling rate fs. 5. Now I pass the two channels through filters 6. I then combine the two channels to get the output which is similar to the original input. I need to calculate the error between the input and the output. Since the ouput is from the filters I need to take into account the delay before I compute the mean square error. How should I do that???

vasindagi wrote:
> > >vasindagi wrote: > >>> vasindagi wrote: > >>>>> vasindagi wrote: > >>>>>> Hi all, > >>>>>> > >>>>>> Its known that the delay for a FIR filter is (N-1)/2 where N is > the > >>>>>> length of the filter and the filter is symmetric. > >>>>>> > >>>>>> I am supposed to calculate the Mean Square Error between the input > >> and > >>>>>> output of the filter. Since the length of the output will be > greater > >>>> than > >>>>>> the length of the input, I wanted to know how to relate the output > >> of > >>>> the > >>>>>> filter to the input of the filter. > >>>>>> i.e., if x(n) is the input > >>>>>> y(n) is the ouput > >>>>>> length of the filter is N > >>>>>> length(x) = L > >>>>>> length(y) = L+N-1 > >>>>>> therefore, length(y) > length(x) > >>>>>> But to calculate the mean square error the lengths of the 2 > >> sequences > >>>> has > >>>>>> to be equal. So how do I take into account the delay caused by the > >> fir > >>>>>> filter. > >>>>> If the filter does something useful (i.e., the output differs from > the > >> > >>>>> input) what soes "error" signify? > >>>>> > >>>>> Jerry > >>>> Hi Jerry, > >>>> In my case, the output of the filter is the signal reconstructed > using > >> QMF > >>>> filters. That is the input is first split into 2 bands and then > >> combined > >>>> using QMF filters. Obviously in this process there will be some > error > >> due > >>>> to aliasing if the filters used are not brick wall (for lower filter > >>>> lengths). I want to measure this error for which I m using Mean > Square > >>>> Error. > >>> A test scenario in which the only operation on the separate parts is > >>> recombining them can be useful, but only to test the separation and > >>> recombination part of the code. Is that what you want? Altering the > >>> filtered signal in some way, such as clipping the bands separately and > > >>> removing generated out-of-band components, makes sense, but then the > >>> test does not. > >>> > >>> Make sure that your separation filters all have the same (odd) number > of > >> > >>> taps (N), and hence the same integer delay. Make another "filter" of > >>> such length that the output is the input delayed by (N+1)/2 + the > delay > >>> of the recombination process. It is called a delay line, and all > >>> coefficients are zero except for the one that is unity. Compare the > >>> output of the delay line to the reconstituted signal *after N outputs* > > >>> have gone by. > >>> > >>> Jerry > >>> -- > >>> Engineering is the art of making what you want from things you can > get. > >>> > >> > >> > >> Hi Jerry, > >> I was splitting the input signal into two bands and then was down > >> quantizing the higher frequency band and then recombining. This > resulted in > >> a high frequency noise in the reconstructed signal. So I removed the > >> quantization to check out why the high freq noise was occuring. Thats > when > >> I realized that it was happening because of aliasing since the filter > >> length I was using was very low and it dint have the near ideal > >> characterstics. When I started increasing the filter length the noise > >> started reducing. > >> Hence, right now I m just splitting the input and then recombining the > >> splitted signals. > >> > >> Thanks for suggesting the method to delay the input. > > > >Something is going on here that I don't understand. Before a signal can > >downsampled, a low-pass filter is needed to remove the higher > >frequencies that would otherwise alias. High frequencies need high > >sampling rates. You could downsample the lower band, but not the higher. > > >Two signals with different sample rates can't be digitally combined > >without first making their sample rates equal. As I wrote above, I don't > > >understand. > > > >Jerry > >-- > >Engineering is the art of making what you want from things you can get. > >&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533; > > > > Hi Jerry, > > Let me make it clear. As you told I have used filters before downsampling. > I ll explain what is happening. > 1. Let x(n) be the input. > 2. x(n) is input to two filters > (i) Low Pass Filter: whose output includes only low frequencies. > (ii)High Pass Filter: whose output includes only high frequencies. > 3. The output of the filters are sent to downsamlpers which reduce the > sampling rate to fs/2. So we have two channels now the low freq channel and > the high freq channel. Since human ears are less sensitive to high > frequencies, I down quantize (not downsample as you said) the high freq > channel to reduce the bitrate. > > This was the splitting part. Next comes the reconstruction part. > > 4. I upsample the two channels (high freq channel and low freq channel) > which gives 2 channels of sampling rate fs. > 5. Now I pass the two channels through filters > 6. I then combine the two channels to get the output which is similar to > the original input. > > I need to calculate the error between the input and the output. Since the > ouput is from the filters I need to take into account the delay before I > compute the mean square error. How should I do that???
There can be no error. Your hi and lo filters need to have frequency response that sums to unity. The filters need to be even length because the 90 degree out of phase will cancel. Also all aliasing will cancel if the filters are short enough. So lets say: your lo filter is [1,1] then hi filter is [1,-1] So if x[n] is the sequence a b c d e .... Then after filtering and downsample by 2 you have lo a+b c+d e+f ...... hi a-b c-d e-f ...... Then for reconstruction when you stuff with zeroes and filter each again you get: lo a+b a+b c+d c+d e+f e+f ...... hi a-b b-a c-d d-c e-f f-e ...... when you add the 2 sequences you get 2a 2b 2c 2d 2e ...... So assuming you have no overflow the original is perfectly recovered with a gain of 2. -jim ----== Posted via Pronews.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.pronews.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= - Total Privacy via Encryption =---
vasindagi wrote:
>> vasindagi wrote: >>>> vasindagi wrote: >>>>>> vasindagi wrote: >>>>>>> Hi all, >>>>>>> >>>>>>> Its known that the delay for a FIR filter is (N-1)/2 where N is > the >>>>>>> length of the filter and the filter is symmetric. >>>>>>> >>>>>>> I am supposed to calculate the Mean Square Error between the input >>> and >>>>>>> output of the filter. Since the length of the output will be > greater >>>>> than >>>>>>> the length of the input, I wanted to know how to relate the output >>> of >>>>> the >>>>>>> filter to the input of the filter. >>>>>>> i.e., if x(n) is the input >>>>>>> y(n) is the ouput >>>>>>> length of the filter is N >>>>>>> length(x) = L >>>>>>> length(y) = L+N-1 >>>>>>> therefore, length(y) > length(x) >>>>>>> But to calculate the mean square error the lengths of the 2 >>> sequences >>>>> has >>>>>>> to be equal. So how do I take into account the delay caused by the >>> fir >>>>>>> filter. >>>>>> If the filter does something useful (i.e., the output differs from > the >>>>>> input) what soes "error" signify? >>>>>> >>>>>> Jerry >>>>> Hi Jerry, >>>>> In my case, the output of the filter is the signal reconstructed > using >>> QMF >>>>> filters. That is the input is first split into 2 bands and then >>> combined >>>>> using QMF filters. Obviously in this process there will be some > error >>> due >>>>> to aliasing if the filters used are not brick wall (for lower filter >>>>> lengths). I want to measure this error for which I m using Mean > Square >>>>> Error. >>>> A test scenario in which the only operation on the separate parts is >>>> recombining them can be useful, but only to test the separation and >>>> recombination part of the code. Is that what you want? Altering the >>>> filtered signal in some way, such as clipping the bands separately and > >>>> removing generated out-of-band components, makes sense, but then the >>>> test does not. >>>> >>>> Make sure that your separation filters all have the same (odd) number > of >>>> taps (N), and hence the same integer delay. Make another "filter" of >>>> such length that the output is the input delayed by (N+1)/2 + the > delay >>>> of the recombination process. It is called a delay line, and all >>>> coefficients are zero except for the one that is unity. Compare the >>>> output of the delay line to the reconstituted signal *after N outputs* > >>>> have gone by. >>>> >>>> Jerry >>>> -- >>>> Engineering is the art of making what you want from things you can > get. >>> >>> Hi Jerry, >>> I was splitting the input signal into two bands and then was down >>> quantizing the higher frequency band and then recombining. This > resulted in >>> a high frequency noise in the reconstructed signal. So I removed the >>> quantization to check out why the high freq noise was occuring. Thats > when >>> I realized that it was happening because of aliasing since the filter >>> length I was using was very low and it dint have the near ideal >>> characterstics. When I started increasing the filter length the noise >>> started reducing. >>> Hence, right now I m just splitting the input and then recombining the >>> splitted signals. >>> >>> Thanks for suggesting the method to delay the input. >> Something is going on here that I don't understand. Before a signal can >> downsampled, a low-pass filter is needed to remove the higher >> frequencies that would otherwise alias. High frequencies need high >> sampling rates. You could downsample the lower band, but not the higher. > >> Two signals with different sample rates can't be digitally combined >> without first making their sample rates equal. As I wrote above, I don't >> understand.
...
> Hi Jerry, > > Let me make it clear. As you told I have used filters before downsampling. > I ll explain what is happening. > 1. Let x(n) be the input. > 2. x(n) is input to two filters > (i) Low Pass Filter: whose output includes only low frequencies. > (ii)High Pass Filter: whose output includes only high frequencies. > 3. The output of the filters are sent to downsamlpers which reduce the > sampling rate to fs/2.
Why not downsamlple before the filters? Then you need to do it only once, and the filters run at half the speed.
> So we have two channels now the low freq channel and > the high freq channel. Since human ears are less sensitive to high > frequencies, I down quantize (not downsample as you said) the high freq > channel to reduce the bitrate.
Reducing the sample rate is what I meant by downsampling. You need to low-pass filter before doing that. Quantizing to reduce the bit rate may save storage and transmission bandwidth, but saves nothing that I can see after recombining.
> This was the splitting part. Next comes the reconstruction part. > > 4. I upsample the two channels (high freq channel and low freq channel) > which gives 2 channels of sampling rate fs. > 5. Now I pass the two channels through filters > 6. I then combine the two channels to get the output which is similar to > the original input.
So now there is a signal with as many samples as the original. What has been gained?
> I need to calculate the error between the input and the output. Since the > ouput is from the filters I need to take into account the delay before I > compute the mean square error. How should I do that???
Call the input to the system x[n] and the output of the system y[n]. Call the delay through the system be D. After ignoring enough samples to get past the start-up transient, compare y[n] to x[n-D]. Jerry -- Engineering is the art of making what you want from things you can get.