Reply by Jerry Avins July 31, 20042004-07-31
Fred Marshall wrote:

   ...

> That's why I said: "I guess it's a matter of how you define the test setup / > input"
Got it now. Thanks Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by Fred Marshall July 31, 20042004-07-31
"Jerry Avins" <jya@ieee.org> wrote in message
news:410a60d9$0$2828$61fed72c@news.rcn.com...
> Fred Marshall wrote: > > "Jerry Avins" <jya@ieee.org> wrote in message > > news:4107d474$0$2824$61fed72c@news.rcn.com... > > > >>Fred Marshall wrote: > >> > >> > >>>"phuture_project" <phuture_project@yahoo.fr> wrote in message > >>>news:25fe518f.0407280050.64a669f2@posting.google.com... > >>> > >>> > >>>>I've just tested my filter the way Fred suggested. The result is that > >>>>y[n]=h[n]. So the filter seems to work, doesn't it? > >>> > >>> > >>>Well, I said a "good part of it" is working. As Jerry points out,
there
> > > > are > > > >>>other things that could be wrong with the code. But, so far, so good. > >>> > >>>Have you computed an abs(fft) of the coefficients when you did the > > > > filter > > > >>>design? That would be another good test of the filter design / not the > >>>code. > >>> > >>>Then a long sinusoid test - of well more than 800 samples in length. > > > > Throw > > > >>>away the first and last 400 samples of the filter output and see if the > >>>amplitude (and phase perhaps) agrees with the fft. Start with a cosine > > > > of a > > > >>>frequency that is on the frequency sample points. > >>> > >>>Fred > >> > >>Why the last 400? When the input ends on a real signal so zeroes get > >>loaded into the filter, the output goes bad. But why chuck the last > >>results from a test sequence? > > > > > > Jerry, > > > > Well, I said an input sequence of "more than 800 samples" implying a
finite
> > length. > > As such, it will have a starting transient and an ending transient. > > I would throw out both. > > Unless the end of the data is padded with zeros, I don't see an end > transient. as long as there's an actual sample at every tap of the > filter, the output should be valid. What phenomenon have I overlooked > that could change the output from steady state? > > > Now, if there weren't such a finite length, so that the input just
continues
> > indefinitely, then I wouldn't have said that. My aim was to focus on
the
> > steady state part of the filter output. With a finite-length input,
that
> > only exists after output sample 400 and before the input goes away. > > > > Actually I should have said "well more than 400 samples". I ignored any > > preceding or succeeding zeros that you might either imagine or actually
have
> > at the ends of the "test sequence". My assumption was that the test > > sequence was only the sinusoidal part and no more and that transients as > > above would ensue. > > Only the sinusoidal part: OK. As the filter fills -- while its initial > state is being flushed -- the output won't be "normal". The more real > samples and fewer initial garbage is in the filter, the closer to steady > state the output becomes. Unlike analog filters and IIRs which decay > exponentially, an FIR's transient decays linearly. > > Once the filter is full, the transient is gone. What can create a new > one? > > > So, I guess it's a matter of how you define the test setup / input. I
have
> > no issue with what you've asked. > > I don't even know what that means. I'm really out of it! > > Jerry
Jerry, Oh! OK. (re: your last sentence.... :-) It appears you're assuming a "burst step" - i.e. a sinusoid that starts and never ends. In that case there's no ending transient. So we agree. Pretty simple, eh? I was assuming a "burst" - i.e. a sinusoid that starts and ends. I was assuming that the filter is running continuously. When the sinusoid input starts, there is a starting transient. When the sinusoid input ends, there is an ending transient. In my way of thinking, it doesn't matter if you append zeros to the input or not - just as it doesn't matter if you prepend zeros to the input. As long as the input "stops" and the filter keeps running. I know, it's really the same thing. Anyway, this seems our point of confusion. How might one test or use a filter? 1a) Direct temporal convolution - "finite sequences" as might be done in Matlab. Requires a finite length input sequence for a finite computation. Results in an output sequence that includes *both* starting and ending transients. 1b) Direct temporal convolution - "free running" as might be done with a streaming program or in hardware. Assuming an infinitely-long input sequence: Results in an output sequence that has a starting transient only. Assumes that the evaluation observes the output "after a suitable time" and ignores subsequent outputs. 1b) becomes idential to 1a) if the input is a burst and not a "step". 2) Circular convolution. Requires a finite length input sequence. Results in an output sequence that includes both starting and ending transients (or there is temporal aliasing). 3) Fast convolution .... same as circular but uses FFT/IFFT So, of the 4 approaches, only a streaming implementation allows for no ending transient. In any case, you have to decide where to look in the output sequence. If the output sequence is of finite length, then this affects the instructions on "where to look". In 1b you can say to look after so many samples and leave it at that. In the others, you can say the same thing of course. But, to avoid confusion that could result, you might also caution not to consider the end of the output sequence as well. Doing this results rather directly in saying that the input sequence must be of adequate length so that there *is* a valid place in the output to look for steady state response. That's why I said: "I guess it's a matter of how you define the test setup / input" Fred
Reply by Jerry Avins July 30, 20042004-07-30
Fred Marshall wrote:
> "Jerry Avins" <jya@ieee.org> wrote in message > news:4107d474$0$2824$61fed72c@news.rcn.com... > >>Fred Marshall wrote: >> >> >>>"phuture_project" <phuture_project@yahoo.fr> wrote in message >>>news:25fe518f.0407280050.64a669f2@posting.google.com... >>> >>> >>>>I've just tested my filter the way Fred suggested. The result is that >>>>y[n]=h[n]. So the filter seems to work, doesn't it? >>> >>> >>>Well, I said a "good part of it" is working. As Jerry points out, there > > are > >>>other things that could be wrong with the code. But, so far, so good. >>> >>>Have you computed an abs(fft) of the coefficients when you did the > > filter > >>>design? That would be another good test of the filter design / not the >>>code. >>> >>>Then a long sinusoid test - of well more than 800 samples in length. > > Throw > >>>away the first and last 400 samples of the filter output and see if the >>>amplitude (and phase perhaps) agrees with the fft. Start with a cosine > > of a > >>>frequency that is on the frequency sample points. >>> >>>Fred >> >>Why the last 400? When the input ends on a real signal so zeroes get >>loaded into the filter, the output goes bad. But why chuck the last >>results from a test sequence? > > > Jerry, > > Well, I said an input sequence of "more than 800 samples" implying a finite > length. > As such, it will have a starting transient and an ending transient. > I would throw out both.
Unless the end of the data is padded with zeros, I don't see an end transient. as long as there's an actual sample at every tap of the filter, the output should be valid. What phenomenon have I overlooked that could change the output from steady state?
> Now, if there weren't such a finite length, so that the input just continues > indefinitely, then I wouldn't have said that. My aim was to focus on the > steady state part of the filter output. With a finite-length input, that > only exists after output sample 400 and before the input goes away. > > Actually I should have said "well more than 400 samples". I ignored any > preceding or succeeding zeros that you might either imagine or actually have > at the ends of the "test sequence". My assumption was that the test > sequence was only the sinusoidal part and no more and that transients as > above would ensue.
Only the sinusoidal part: OK. As the filter fills -- while its initial state is being flushed -- the output won't be "normal". The more real samples and fewer initial garbage is in the filter, the closer to steady state the output becomes. Unlike analog filters and IIRs which decay exponentially, an FIR's transient decays linearly. Once the filter is full, the transient is gone. What can create a new one?
> So, I guess it's a matter of how you define the test setup / input. I have > no issue with what you've asked.
I don't even know what that means. I'm really out of it! 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;
Reply by Fred Marshall July 30, 20042004-07-30
"Jerry Avins" <jya@ieee.org> wrote in message
news:4107d474$0$2824$61fed72c@news.rcn.com...
> Fred Marshall wrote: > > > "phuture_project" <phuture_project@yahoo.fr> wrote in message > > news:25fe518f.0407280050.64a669f2@posting.google.com... > > > >>I've just tested my filter the way Fred suggested. The result is that > >>y[n]=h[n]. So the filter seems to work, doesn't it? > > > > > > Well, I said a "good part of it" is working. As Jerry points out, there
are
> > other things that could be wrong with the code. But, so far, so good. > > > > Have you computed an abs(fft) of the coefficients when you did the
filter
> > design? That would be another good test of the filter design / not the > > code. > > > > Then a long sinusoid test - of well more than 800 samples in length.
Throw
> > away the first and last 400 samples of the filter output and see if the > > amplitude (and phase perhaps) agrees with the fft. Start with a cosine
of a
> > frequency that is on the frequency sample points. > > > > Fred > > Why the last 400? When the input ends on a real signal so zeroes get > loaded into the filter, the output goes bad. But why chuck the last > results from a test sequence?
Jerry, Well, I said an input sequence of "more than 800 samples" implying a finite length. As such, it will have a starting transient and an ending transient. I would throw out both. Now, if there weren't such a finite length, so that the input just continues indefinitely, then I wouldn't have said that. My aim was to focus on the steady state part of the filter output. With a finite-length input, that only exists after output sample 400 and before the input goes away. Actually I should have said "well more than 400 samples". I ignored any preceding or succeeding zeros that you might either imagine or actually have at the ends of the "test sequence". My assumption was that the test sequence was only the sinusoidal part and no more and that transients as above would ensue. So, I guess it's a matter of how you define the test setup / input. I have no issue with what you've asked. Fred
Reply by Jerry Avins July 28, 20042004-07-28
Fred Marshall wrote:

> "phuture_project" <phuture_project@yahoo.fr> wrote in message > news:25fe518f.0407280050.64a669f2@posting.google.com... > >>I've just tested my filter the way Fred suggested. The result is that >>y[n]=h[n]. So the filter seems to work, doesn't it? > > > Well, I said a "good part of it" is working. As Jerry points out, there are > other things that could be wrong with the code. But, so far, so good. > > Have you computed an abs(fft) of the coefficients when you did the filter > design? That would be another good test of the filter design / not the > code. > > Then a long sinusoid test - of well more than 800 samples in length. Throw > away the first and last 400 samples of the filter output and see if the > amplitude (and phase perhaps) agrees with the fft. Start with a cosine of a > frequency that is on the frequency sample points. > > Fred
Why the last 400? When the input ends on a real signal so zeroes get loaded into the filter, the output goes bad. But why chuck the last results from a test sequence? 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;
Reply by Fred Marshall July 28, 20042004-07-28
"phuture_project" <phuture_project@yahoo.fr> wrote in message
news:25fe518f.0407280050.64a669f2@posting.google.com...
> I've just tested my filter the way Fred suggested. The result is that > y[n]=h[n]. So the filter seems to work, doesn't it?
Well, I said a "good part of it" is working. As Jerry points out, there are other things that could be wrong with the code. But, so far, so good. Have you computed an abs(fft) of the coefficients when you did the filter design? That would be another good test of the filter design / not the code. Then a long sinusoid test - of well more than 800 samples in length. Throw away the first and last 400 samples of the filter output and see if the amplitude (and phase perhaps) agrees with the fft. Start with a cosine of a frequency that is on the frequency sample points. Fred
Reply by Jerry Avins July 28, 20042004-07-28
phuture_project wrote:

> I've just tested my filter the way Fred suggested. The result is that > y[n]=h[n]. So the filter seems to work, doesn't it?
Yes. Nevertheless, the results on a continuing sequence don't meet your expectations. There can be several reasons for that. 1) Your expectations are not realistic. 2) The sequence is not what you think it is. a) Its elements are not used in the assumed sequence. b) ? 3) With more than one non-zero datum, arithmetic overflow is possible. 4) The real problem, as yet not imagined. 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;
Reply by phuture_project July 28, 20042004-07-28
I've just tested my filter the way Fred suggested. The result is that
y[n]=h[n]. So the filter seems to work, doesn't it?
Reply by Fred Marshall July 27, 20042004-07-27
"phuture_project" <phuture_project@yahoo.fr> wrote in message
news:25fe518f.0407262316.41460911@posting.google.com...
> Hi Jim, > > > You've explained what you are doing in theory, but gave no details of
the
> > implementation. Obviously there's something amiss in your
implemenytation, but
> > how are we supposed to guess what it might be? > > One guess, that you are using a very long filter on a very short amount
of
> > data. Or maybe just a typo in your code. > > What are you missing? I thought i explained all the useful things. Did > you read all my posts on this subject? Anyway, please tell me what you > are missing, and i'll give it. > To repeat it, i use a 401 coefficients FIR filter (maybe that's what > you call a very long filter, i don't know) and as far as the amount of > data is concerned, i just asked how many samples should i get in order > to have a good response. I tried with 200, 401, 500 or even 802 > samples. Everytime i have the same result. > > Maybe it can help, so here is a part of my code:
I won't read the code either .... but you should definitely test the filter. One good way is this: Input a sequence that is 1 0 0 0 0 0 0 0 0 0 0 0 0 ..... The output should recreate the filter coefficients - with whatever scaling is being done. If it does, then it appears that a good part of the filter is working. There should be 401 nonzero output samples (as long as none of the coefficients are zero...). Fred
Reply by Jerry Avins July 27, 20042004-07-27
phuture_project wrote:

 > Hi Jim,
 >
 >
 >> You've explained what you are doing in theory, but gave no details 
of the
 >> implementation. Obviously there's something amiss in your 
implemenytation, but
 >> how are we supposed to guess what it might be?
 >> One guess, that you are using a very long filter on a very short 
amount of
 >> data. Or maybe just a typo in your code.
 >
 >
 >
 > What are you missing? I thought i explained all the useful things. Did
 > you read all my posts on this subject? Anyway, please tell me what you
 > are missing, and i'll give it.
 > To repeat it, i use a 401 coefficients FIR filter (maybe that's what
 > you call a very long filter, i don't know) and as far as the amount of
 > data is concerned, i just asked how many samples should i get in order
 > to have a good response. I tried with 200, 401, 500 or even 802
 > samples. Everytime i have the same result.


The beginning  of the output is a transient. Removing the first 400
samples will leave only the completely valid ones. Removing the first
350 samples will leave samples that approximate reality. (Usually, an
FIR filter's impulse response is small at the ends, so ignoring those
effects doesn't make a signal unrecognizable.)

All filters, even analog, need time to settle. Amplifiers "thump" at
power-on and power-off. It's usually tolerable because the signals we
want are much longer than the settling times.

I'm not going to read your code. I don't have the means to compile it,
but if I did and if it were complete, I would do that. You can provide
enough data for an adequate test, or build a short test filter to
exercise the rest of your code. Either approach might show you what you
need to know.

   ...

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;