DSPRelated.com
Forums

Optimum length for a mean filter

Started by mermeladeK November 15, 2007
Hi all,

This is a quite basic question:

I am doing some nuclear spectroscopy where I use a shaping filter that
basically transforms a step input into a triangular pulse.

Mainly, what the shaping filter is doing is reducing the noise and
outputting a pulse whose amplitude is still proportional to the step input
amplitude. The impulse response of this triangular shaping is a positive
"square" followed by a negative "square".

In practical terms this filter just acts as a mean filter with a certain
length. In theory if it has a larger length the noise reduction is higher
(AWGN). However there is a point where a larger mean time doesn't reduce
the noise anymore.
Why? What is the optimum length then?

Thank you very much.


mermeladeK wrote:
> Hi all, > > This is a quite basic question: > > I am doing some nuclear spectroscopy where I use a shaping filter that > basically transforms a step input into a triangular pulse. > > Mainly, what the shaping filter is doing is reducing the noise and > outputting a pulse whose amplitude is still proportional to the step input > amplitude. The impulse response of this triangular shaping is a positive > "square" followed by a negative "square". > > In practical terms this filter just acts as a mean filter with a certain > length. In theory if it has a larger length the noise reduction is higher > (AWGN). However there is a point where a larger mean time doesn't reduce > the noise anymore. > Why? What is the optimum length then?
I can't construct a consistent model for your process. Maybe we mean different things by the same terms. This is what your terms mean to me: Step input, ignoring noise; the signal is zero until a particular time and is some finite value thereafter. An example is the unit step. it is zero for all negative time and 1 for all positive time. Triangular pulse, again ignoring noise; the signal rises from zero to a maximum in finite time, then returns to zero in in finite time. ### An impulse response which is a positive "square" followed by a negative one of equal size produces an output which has no DC component. A triangular pulse has such a component. That impulse response has characteristics of a differentiator. Differentiators emphasize noise. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Hi Jerry,

Yes the input signal is a step, as you defined it, plus AWGN. The impulse
response is AC as you said as well. The differentiator is as you say not
good for the signal since it decreases the signal more than the noise.
However is before the negative "square" of the impulse response starts
working that it is important me. That is just to make the filter AC.

So before the negative square there is the positive one, that works as an
integrator, so it improves the SNR. The maximum of the output signal, the
triangle, is proportional to the amplitude of the input step.

What I was asking is that in theory, in order to have the best relation
signal to noise, the longer the impulse response the better. But in
practice, it's not true. When I use too long impulse responses the noise
stops deacreasing. What is more it even increases.

So my question, is there some more theory that explains why there is a
point where longer lengths for the impulse response don't increase the
SNR? And what is the optimum length?
I think I heard something about too much lenght would distort the signal,
hence stop improving the SNR...

>mermeladeK wrote: >> Hi all, >> >> This is a quite basic question: >> >> I am doing some nuclear spectroscopy where I use a shaping filter that >> basically transforms a step input into a triangular pulse. >> >> Mainly, what the shaping filter is doing is reducing the noise and >> outputting a pulse whose amplitude is still proportional to the step
input
>> amplitude. The impulse response of this triangular shaping is a
positive
>> "square" followed by a negative "square". >> >> In practical terms this filter just acts as a mean filter with a
certain
>> length. In theory if it has a larger length the noise reduction is
higher
>> (AWGN). However there is a point where a larger mean time doesn't
reduce
>> the noise anymore. >> Why? What is the optimum length then? > >I can't construct a consistent model for your process. Maybe we mean >different things by the same terms. This is what your terms mean to me: > >Step input, ignoring noise; the signal is zero until a particular time >and is some finite value thereafter. An example is the unit step. it is >zero for all negative time and 1 for all positive time. > >Triangular pulse, again ignoring noise; the signal rises from zero to a >maximum in finite time, then returns to zero in in finite time. > >### > >An impulse response which is a positive "square" followed by a negative >one of equal size produces an output which has no DC component. A >triangular pulse has such a component. That impulse response has >characteristics of a differentiator. Differentiators emphasize noise. > >Jerry >-- >Engineering is the art of making what you want from things you can get. >����������������������������������������������������������������������� >
mermeladeK wrote:
> Hi Jerry, > > Yes the input signal is a step, as you defined it, plus AWGN. The impulse > response is AC as you said as well. The differentiator is as you say not > good for the signal since it decreases the signal more than the noise. > However is before the negative "square" of the impulse response starts > working that it is important me. That is just to make the filter AC. > > So before the negative square there is the positive one, that works as an > integrator, so it improves the SNR. The maximum of the output signal, the > triangle, is proportional to the amplitude of the input step. > > What I was asking is that in theory, in order to have the best relation > signal to noise, the longer the impulse response the better. But in > practice, it's not true. When I use too long impulse responses the noise > stops deacreasing. What is more it even increases. > > So my question, is there some more theory that explains why there is a > point where longer lengths for the impulse response don't increase the > SNR? And what is the optimum length? > I think I heard something about too much lenght would distort the signal, > hence stop improving the SNR...
When you say that the noise increases, do you mean in absolute value, or relative to the signal? The signal, after all, is a linear ramp whose slope is determined by the height of your square, and whose duration is equal to the square's. Increasing the duration increases the height in proportion. Do you observe that the signal-to-noise /ratio/ actually decreases? The second half of your filter's impulse response is not material to the question at hand. (It may have an important purpose; I'd like to know what.) The first half is a poor low-pass filter; you might do better with a different one. If that seems to be a possibly reasonable direction for you, I and others here will be happy to discuss an implementation. Jerry -- Engineering is the art of making what you want from things you can get.
Hi Jerry,

When I say that the noise increases or decreases I am refering to the
relative value to the signal. Exactly the filter is just a low pass filter
if you ommit the second half which is not really relevant.

I don't want another type of filter since this is the most narrow
frequency filter I can have, that is to say, the one that deletes more
noise. The main question is, when I increase the length of the mean filter
(the low pass filter), there is a point where the SNR stops increasing. Do
you know why?

>mermeladeK wrote: >> Hi Jerry, >> >> Yes the input signal is a step, as you defined it, plus AWGN. The
impulse
>> response is AC as you said as well. The differentiator is as you say
not
>> good for the signal since it decreases the signal more than the noise. >> However is before the negative "square" of the impulse response starts >> working that it is important me. That is just to make the filter AC. >> >> So before the negative square there is the positive one, that works as
an
>> integrator, so it improves the SNR. The maximum of the output signal,
the
>> triangle, is proportional to the amplitude of the input step. >> >> What I was asking is that in theory, in order to have the best
relation
>> signal to noise, the longer the impulse response the better. But in >> practice, it's not true. When I use too long impulse responses the
noise
>> stops deacreasing. What is more it even increases. >> >> So my question, is there some more theory that explains why there is a >> point where longer lengths for the impulse response don't increase the >> SNR? And what is the optimum length? >> I think I heard something about too much lenght would distort the
signal,
>> hence stop improving the SNR... > >When you say that the noise increases, do you mean in absolute value, or
>relative to the signal? The signal, after all, is a linear ramp whose >slope is determined by the height of your square, and whose duration is >equal to the square's. Increasing the duration increases the height in >proportion. Do you observe that the signal-to-noise /ratio/ actually >decreases? > >The second half of your filter's impulse response is not material to the
>question at hand. (It may have an important purpose; I'd like to know >what.) The first half is a poor low-pass filter; you might do better >with a different one. If that seems to be a possibly reasonable >direction for you, I and others here will be happy to discuss an >implementation. > >Jerry >-- >Engineering is the art of making what you want from things you can get. >
On Nov 15, 4:19 pm, "mermeladeK" <nil.gar...@gmail.com> wrote:
> Hi Jerry, > > When I say that the noise increases or decreases I am refering to the > relative value to the signal. Exactly the filter is just a low pass filter > if you ommit the second half which is not really relevant. > > I don't want another type of filter since this is the most narrow > frequency filter I can have, that is to say, the one that deletes more > noise. The main question is, when I increase the length of the mean filter > (the low pass filter), there is a point where the SNR stops increasing. Do > you know why? > > > > >mermeladeK wrote: > >> Hi Jerry, > > >> Yes the input signal is a step, as you defined it, plus AWGN. The > impulse > >> response is AC as you said as well. The differentiator is as you say > not > >> good for the signal since it decreases the signal more than the noise. > >> However is before the negative "square" of the impulse response starts > >> working that it is important me. That is just to make the filter AC. > > >> So before the negative square there is the positive one, that works as > an > >> integrator, so it improves the SNR. The maximum of the output signal, > the > >> triangle, is proportional to the amplitude of the input step. > > >> What I was asking is that in theory, in order to have the best > relation > >> signal to noise, the longer the impulse response the better. But in > >> practice, it's not true. When I use too long impulse responses the > noise > >> stops deacreasing. What is more it even increases. > > >> So my question, is there some more theory that explains why there is a > >> point where longer lengths for the impulse response don't increase the > >> SNR? And what is the optimum length? > >> I think I heard something about too much lenght would distort the > signal, > >> hence stop improving the SNR... > > >When you say that the noise increases, do you mean in absolute value, or > >relative to the signal? The signal, after all, is a linear ramp whose > >slope is determined by the height of your square, and whose duration is > >equal to the square's. Increasing the duration increases the height in > >proportion. Do you observe that the signal-to-noise /ratio/ actually > >decreases? > > >The second half of your filter's impulse response is not material to the > >question at hand. (It may have an important purpose; I'd like to know > >what.) The first half is a poor low-pass filter; you might do better > >with a different one. If that seems to be a possibly reasonable > >direction for you, I and others here will be happy to discuss an > >implementation. > > >Jerry > >-- > >Engineering is the art of making what you want from things you can get.
This is how it looks to me: Input-no signal: zero mean AWGN Signal: Step function, I'll assume a sign (positive) to make it easier to talk about Detection filter impulse response: single cycle square wave, first positive then negative Output of noise w/o signal: zero mean AWGN proportional to the square root of the impulse response duration Output of signal w/o AWGN: triangle wave, peak proportional to the impulse response duration, impulse response duration equal to that of the square wave. The operations are linear so the output will be the sum of the two previous items. Now, what is the optimum length of the impulse response? Well, optimum for what? To merely detect the signal, a threshold crossing can be used. For a fixed false alarm rate, the level will have to be increased as the square root of the impulse response length of the square wave. As the impulse response length is increased at constant false alarm rate, the system will be capable of detecting signals of amplitude inversely proportional to impulse duration, but the delay between the signal onset and the detection will increase. Is this what was meant by distortion? To detect and measure the amplitude of an input signal, the value of peaks in the output can be used. If the peak exceeds a threshold, a detection is called. The amplitude of the peak is proportional to the height of the input step function and the time of signal onset precedes the detected peak by half the impulse response length of the square wave. The threshold can be varied at a fixed impulse length to tradeoff between false alarm rate and sensitivity. If the sensitivity is increased by increasing the impulse response length, you have to be able to wait longer to get your amplitude measurement. A more complicated detection structure could verify that the threshold exceedances were due to triangle waves and would add more delay to the process. SNR at the peak of the triangle output should continue to increase as the impulse response length increases. But it will be worse at a given delay from the onset of the step function until the signal response has had time to exceed the noise output from longer impulse response length. Limits on the real usefulness of increasing the impulse response length can come from nonstationarity of the additive noise, limits (such as AC coupling) on how long the input signal really represents a step function and the tolerable delay in response time. The square wave is a differentiator. Fortunately it is a poor and narrow bandwidth differentiator. The usefulness of the negative portion of the impulse response may come from the multiplierless ability to set a constant baseline for the detection process just as the positive portion provides a poor but multiplierless matched filter for the input signal. Dale B. Dalrymple http://dbdimages.com http://stores.lulu.com/dbd
mermeladeK wrote:
> Hi Jerry, > > When I say that the noise increases or decreases I am refering to the > relative value to the signal. Exactly the filter is just a low pass filter > if you ommit the second half which is not really relevant. > > I don't want another type of filter since this is the most narrow > frequency filter I can have, that is to say, the one that deletes more > noise. The main question is, when I increase the length of the mean filter > (the low pass filter), there is a point where the SNR stops increasing. Do > you know why?
I don't know why. I'd like to see it. Since it runs counter to what we both believe should happen, I suspect that the effect is only apparent. My doubt remains tentative because such a strong statement requires strong support, and I can't supply it. An integrator, seen as a low-pass filter, rolls off at 20 dB/decade. Good digital filters can drop 60 dB in a third of an octave or less. By what criterion is an integrator the best low-pass filter you can have? 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;
Jerry Avins wrote:
> mermeladeK wrote: >> Hi Jerry, >> >> When I say that the noise increases or decreases I am refering to the >> relative value to the signal. Exactly the filter is just a low pass >> filter >> if you ommit the second half which is not really relevant. >> >> I don't want another type of filter since this is the most narrow >> frequency filter I can have, that is to say, the one that deletes more >> noise. The main question is, when I increase the length of the mean >> filter >> (the low pass filter), there is a point where the SNR stops >> increasing. Do >> you know why? > > I don't know why. I'd like to see it. Since it runs counter to what we > both believe should happen, I suspect that the effect is only apparent. > My doubt remains tentative because such a strong statement requires > strong support, and I can't supply it. > > An integrator, seen as a low-pass filter, rolls off at 20 dB/decade. > Good digital filters can drop 60 dB in a third of an octave or less. By > what criterion is an integrator the best low-pass filter you can have?
I think I understand your filter. A signal is continuously applied to its input, and the noise in the signal is averaged continuously. (Assuming constant noise, it increases in the first half of the filter with the the square root of its duration. The second half of the filter subtracts the noise back out so the integrator doesn't overflow. The ramp is superimposed on the accumulated noise when the step begins. The highest part of the ramp will have the best signal-to-noise ratio *provided that the step duration exceeds the positive part of the impulse response* and the the step's noise-free amplitude is constant. If the SNR deteriorates with increasing IR duration, it is possible that the step is actually a pulse that isn't long enough. If my view of the filter -- that its input is fed continuously -- is correct, you can get much better performance with a modification. Whether in the end you choose stay with an integrator or use a better filter, blocking the filter's input until a step is detected will keep out much of the noise. Jerry -- Engineering is the art of making what you want from things you can get.
Hi,

you might have a look at the "matched filter" concept from a
communications textbook. 

If I limit the bandwidth towards DC (highpass characteristics with a very
low cutoff frequency), then the impulse response of pulse and ideal filter
both decay with time.
A matched filter also rejects out-of-band noise.

-mn
On Nov 15, 7:14 pm, Jerry Avins <j...@ieee.org> wrote:
.> Jerry Avins wrote:
...
.> Whether in the end you
.> choose stay with an integrator or use a better filter, blocking the
.> filter's input until a step is detected will keep out much of the
noise.
.>
.> Jerry

While this statement is certainly true it is not of much use to the
step detector itself. You have obviously provided another example of
the classic detector optimized to minimize false alarm rate by being
turned off. This is probably no longer patentable as it was widely
known before the end of the last century. But with the patent system
you never know...

Dale B. Dalrymple