Reply by Maurice Givens July 27, 20032003-07-27
Zach,
Yes, the picture did not come through.  However, from your verbal
description, it sounds like your are trying to do active noise
cancellation (where your noise is the reference signal).  I suggest
you look at some papers by Sen Kuo from Northern Illinois Univ.  He
wrote a tutorial for the Proceedings of the IEEE some years ago.  I
think this will help you a lot.  I have worked with Prof. Kuo on
several occations, and mentored a couple of his grad students. He is
very knowledgeable in this area.

Maurice Givens



"Zach R." <zrimkunas@verizon.net> wrote in message news:<glxUa.441$JS2.76@nwrdny03.gnilink.net>...
> "Zach R." <zrimkunas@verizon.net> wrote in message > news:lfwUa.3057$cM6.1775@nwrdny01.gnilink.net... > > > > "Maurice Givens" <maurice.givens@ieee.org> wrote in message > > news:eb93cce8.0307251151.1a4d1cfc@posting.google.com... > > > Zach, > > > You might want to give us a diagram of what you have. For instance, > > > if the configuration is > > > > > > > > > > > > .---------<----------. > > > > | | > > > > | | > > > > v ^ > > > > input ----.---->--------[adaptive filter]---->(+)----+---->output > > > > | ^ > > > > | | > > > > | | > > > > '------->------------------->--------' > > > > "main channel" > > > > > > > > > > as was given before, and the "main channel" is a wire (i.e. the input > > > goes to the adap. filt. input, and directly to the summer), then > > > everything you put into the adap. filt. will be cancelled (the adap. > > > filt. will just be an impulse at t=0). > > > > > > If you indeed are trying to cancel the output of an unknown system, > > > then as long as the system impulse response is linear, the adap. filt. > > > won't care what signal you put into it (theoritically, of course. > > > There are some signals, depending on implementation, that can cause > > > the filter to become unstable). You also need to be aware of the > > > problem with signals that have poorly conditioned autocorrleation > > > matrices, such as sinusoids. > > > > > > "Zach R." <zrimkunas@verizon.net> wrote in message > news:<7BjTa.54036$EZ2.3409@nwrddc01.gnilink.net>... > > > > Hi, > > > > I have implemented a simple LMS algorithm w/ a 10th order filter. > My > > > > goal is to completely cancel my reference signal. I can get it to > work > with > > > > a sine wave at about 75 Hz. When I try to cancel a 150 Hz signal all > I > get > > > > is an unstable response. Ultimately I would like to be able to do a > decent > > > > job of cancelling a voice signal. > > > > My main question is: Is it even possible for a LMS algorithm to > cancel a > > > > quickly changing signal such as voice or is it limited only to > relatively > > > > simple signals? > > > > > > > > Another related question is: To increase stability would bringing > the > > > > filter order down work? > > > > > > > > Thanks for any help, > > > > Zach > > > > Hi guys, > > Thanks for your help again. Sorry I haven't gotten a block diagram up > > earlier but here is generally what I have: > > > > > > ^ > > / > > ______/____ > > | > > | > > | Filter > | > > > > ___________________|_________|____________________________ > > | / > > | > | _________ | > > | > | |Control | |------------| > > |------------| | > | |Filter | |Adaptive | > > | Reference | | > -----|-----------| ---| Algorithm |-----------| > > | | > Ref Out | |------------| > > |------------| | > | | > > | > / |____________________________ > > | > > /|/\/\/\/\/\/ > | > > \ | > > |/ | > > > |\ | > > | |/\/\/\/\/\/ > | > > \/\/\/\/\/| \| > > | | O > \/\/\/\/\/ | | -> Cancellation Signal > > |\ |/\/\/\/\/\/ > Mic > > \/\/\/\/\/| /| > > \| > > |/ > > \ > > / > > > > > > Ok, that is it. Its probably not the clearest but I'll try to explain > some. > > I have the reference and the microphone signal going into the adaptive > > algorithm. These two signals are used to create the filter coefficients > > using a normalized LMS algorithm. The two poorly represented figures on > the > > bottom left and right are my speakers. The mic is located between the two > > speakers. Out of one speaker is the same reference signal fed into the > > adaptive algorithm. I am trying to get the adaptive algorithm to create a > > filter which will then filter the reference signal to make an out of phase > > version it (the reference). Just simple destructive interference. > > > > In addition, the control filter has not yet been implemented. Its purpose > > will be to make up for the delays in the system, etc. Does this help? > > Please let me know if I can clarify anything else for you. > > > > Again, thanks for your help and time. > > > > Zach > > > > > That didn't go very well!!! > > I'll get another up. > Zach
Reply by Maurice Givens July 27, 20032003-07-27
For system identification, the only limitation placed on the
derivation of the LMS algorithm is a well-conditioned input
autocorrelation matrix.  Even non-linear impulse responses can be
accomodated if the model is chosen well and the derivation of the
algorithm (based on minimizing the squared error) is done correctly.


Maurice Givens


> > Your comments provide good insight! I guess for noiselike inputs or > arbitrary inputs, right? > > Fred
Reply by Jerry Avins July 27, 20032003-07-27
"Zach R." wrote:
>
...
> > > > That didn't go very well!!! > > I'll get another up. > Zach
Set your wrap length to be at least as long as the window you compose in is wide, and be sure that there's a cr at the end of each line. (Monospace font and no tabs, of course.) 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 Zach R. July 26, 20032003-07-26
"Zach R." <zrimkunas@verizon.net> wrote in message
news:lfwUa.3057$cM6.1775@nwrdny01.gnilink.net...
> > "Maurice Givens" <maurice.givens@ieee.org> wrote in message > news:eb93cce8.0307251151.1a4d1cfc@posting.google.com... > > Zach, > > You might want to give us a diagram of what you have. For instance, > > if the configuration is > > > > > > > > > .---------<----------. > > > | | > > > | | > > > v ^ > > > input ----.---->--------[adaptive filter]---->(+)----+---->output > > > | ^ > > > | | > > > | | > > > '------->------------------->--------' > > > "main channel" > > > > > > > as was given before, and the "main channel" is a wire (i.e. the input > > goes to the adap. filt. input, and directly to the summer), then > > everything you put into the adap. filt. will be cancelled (the adap. > > filt. will just be an impulse at t=0). > > > > If you indeed are trying to cancel the output of an unknown system, > > then as long as the system impulse response is linear, the adap. filt. > > won't care what signal you put into it (theoritically, of course. > > There are some signals, depending on implementation, that can cause > > the filter to become unstable). You also need to be aware of the > > problem with signals that have poorly conditioned autocorrleation > > matrices, such as sinusoids. > > > > "Zach R." <zrimkunas@verizon.net> wrote in message > news:<7BjTa.54036$EZ2.3409@nwrddc01.gnilink.net>... > > > Hi, > > > I have implemented a simple LMS algorithm w/ a 10th order filter. > My > > > goal is to completely cancel my reference signal. I can get it to
work
> with > > > a sine wave at about 75 Hz. When I try to cancel a 150 Hz signal all
I
> get > > > is an unstable response. Ultimately I would like to be able to do a > decent > > > job of cancelling a voice signal. > > > My main question is: Is it even possible for a LMS algorithm to > cancel a > > > quickly changing signal such as voice or is it limited only to > relatively > > > simple signals? > > > > > > Another related question is: To increase stability would bringing > the > > > filter order down work? > > > > > > Thanks for any help, > > > Zach > > Hi guys, > Thanks for your help again. Sorry I haven't gotten a block diagram up > earlier but here is generally what I have: > > > ^ > / > ______/____ > | > | > | Filter
|
> > ___________________|_________|____________________________ > | / > | > | _________ | > | > | |Control | |------------| > |------------| | > | |Filter | |Adaptive | > | Reference | | > -----|-----------| ---| Algorithm |-----------| > | | > Ref Out | |------------| > |------------| | > | | > | > / |____________________________ > | > /|/\/\/\/\/\/
|
> \ | > |/ |
|
> |\ | > | |/\/\/\/\/\/
|
> \/\/\/\/\/| \| > | | O > \/\/\/\/\/ | | -> Cancellation Signal > |\ |/\/\/\/\/\/
Mic
> \/\/\/\/\/| /| > \| > |/ > \ > / > > > Ok, that is it. Its probably not the clearest but I'll try to explain
some.
> I have the reference and the microphone signal going into the adaptive > algorithm. These two signals are used to create the filter coefficients > using a normalized LMS algorithm. The two poorly represented figures on
the
> bottom left and right are my speakers. The mic is located between the two > speakers. Out of one speaker is the same reference signal fed into the > adaptive algorithm. I am trying to get the adaptive algorithm to create a > filter which will then filter the reference signal to make an out of phase > version it (the reference). Just simple destructive interference. > > In addition, the control filter has not yet been implemented. Its purpose > will be to make up for the delays in the system, etc. Does this help? > Please let me know if I can clarify anything else for you. > > Again, thanks for your help and time. > > Zach >
That didn't go very well!!! I'll get another up. Zach
Reply by Zach R. July 26, 20032003-07-26
"Maurice Givens" <maurice.givens@ieee.org> wrote in message
news:eb93cce8.0307251151.1a4d1cfc@posting.google.com...
> Zach, > You might want to give us a diagram of what you have. For instance, > if the configuration is > > > > > > .---------<----------. > > | | > > | | > > v ^ > > input ----.---->--------[adaptive filter]---->(+)----+---->output > > | ^ > > | | > > | | > > '------->------------------->--------' > > "main channel" > > > > as was given before, and the "main channel" is a wire (i.e. the input > goes to the adap. filt. input, and directly to the summer), then > everything you put into the adap. filt. will be cancelled (the adap. > filt. will just be an impulse at t=0). > > If you indeed are trying to cancel the output of an unknown system, > then as long as the system impulse response is linear, the adap. filt. > won't care what signal you put into it (theoritically, of course. > There are some signals, depending on implementation, that can cause > the filter to become unstable). You also need to be aware of the > problem with signals that have poorly conditioned autocorrleation > matrices, such as sinusoids. > > "Zach R." <zrimkunas@verizon.net> wrote in message
news:<7BjTa.54036$EZ2.3409@nwrddc01.gnilink.net>...
> > Hi, > > I have implemented a simple LMS algorithm w/ a 10th order filter.
My
> > goal is to completely cancel my reference signal. I can get it to work
with
> > a sine wave at about 75 Hz. When I try to cancel a 150 Hz signal all I
get
> > is an unstable response. Ultimately I would like to be able to do a
decent
> > job of cancelling a voice signal. > > My main question is: Is it even possible for a LMS algorithm to
cancel a
> > quickly changing signal such as voice or is it limited only to
relatively
> > simple signals? > > > > Another related question is: To increase stability would bringing
the
> > filter order down work? > > > > Thanks for any help, > > Zach
Hi guys, Thanks for your help again. Sorry I haven't gotten a block diagram up earlier but here is generally what I have: ^ / ______/____ | | | Filter | ___________________|_________|____________________________ | / | | _________ | | | |Control | |------------| |------------| | | |Filter | |Adaptive | | Reference | | -----|-----------| ---| Algorithm |-----------| | | Ref Out | |------------| |------------| | | | | / |____________________________ | /|/\/\/\/\/\/ | \ | |/ | | |\ | | |/\/\/\/\/\/ | \/\/\/\/\/| \| | | O \/\/\/\/\/ | | -> Cancellation Signal |\ |/\/\/\/\/\/ Mic \/\/\/\/\/| /| \| |/ \ / Ok, that is it. Its probably not the clearest but I'll try to explain some. I have the reference and the microphone signal going into the adaptive algorithm. These two signals are used to create the filter coefficients using a normalized LMS algorithm. The two poorly represented figures on the bottom left and right are my speakers. The mic is located between the two speakers. Out of one speaker is the same reference signal fed into the adaptive algorithm. I am trying to get the adaptive algorithm to create a filter which will then filter the reference signal to make an out of phase version it (the reference). Just simple destructive interference. In addition, the control filter has not yet been implemented. Its purpose will be to make up for the delays in the system, etc. Does this help? Please let me know if I can clarify anything else for you. Again, thanks for your help and time. Zach
Reply by Fred Marshall July 25, 20032003-07-25
"Maurice Givens" <maurice.givens@ieee.org> wrote in message
news:eb93cce8.0307251151.1a4d1cfc@posting.google.com...
> Zach, > You might want to give us a diagram of what you have. For instance, > if the configuration is > > > > > > .---------<----------. > > | | > > | | > > v ^ > > input ----.---->--------[adaptive filter]---->(+)----+---->output > > | ^ > > | | > > | | > > '------->------------------->--------' > > "main channel" > > > > as was given before, and the "main channel" is a wire (i.e. the input > goes to the adap. filt. input, and directly to the summer), then > everything you put into the adap. filt. will be cancelled (the adap. > filt. will just be an impulse at t=0). > > If you indeed are trying to cancel the output of an unknown system, > then as long as the system impulse response is linear, the adap. filt. > won't care what signal you put into it (theoritically, of course. > There are some signals, depending on implementation, that can cause > the filter to become unstable). You also need to be aware of the > problem with signals that have poorly conditioned autocorrleation > matrices, such as sinusoids.
Maurice, We can't really be sure this is the right block diagram because Zach hasn't told us. If he wants to cancel from a reference signal, we don't know where that signal comes from. So, this diagram was just a stylized starting point for discussion. Your comments provide good insight! I guess for noiselike inputs or arbitrary inputs, right? Fred
Reply by Maurice Givens July 25, 20032003-07-25
Zach,
You might want to give us a diagram of what you have.  For instance,
if the configuration is
> > > .---------<----------. > | | > | | > v ^ > input ----.---->--------[adaptive filter]---->(+)----+---->output > | ^ > | | > | | > '------->------------------->--------' > "main channel" >
as was given before, and the "main channel" is a wire (i.e. the input goes to the adap. filt. input, and directly to the summer), then everything you put into the adap. filt. will be cancelled (the adap. filt. will just be an impulse at t=0). If you indeed are trying to cancel the output of an unknown system, then as long as the system impulse response is linear, the adap. filt. won't care what signal you put into it (theoritically, of course. There are some signals, depending on implementation, that can cause the filter to become unstable). You also need to be aware of the problem with signals that have poorly conditioned autocorrleation matrices, such as sinusoids. "Zach R." <zrimkunas@verizon.net> wrote in message news:<7BjTa.54036$EZ2.3409@nwrddc01.gnilink.net>...
> Hi, > I have implemented a simple LMS algorithm w/ a 10th order filter. My > goal is to completely cancel my reference signal. I can get it to work with > a sine wave at about 75 Hz. When I try to cancel a 150 Hz signal all I get > is an unstable response. Ultimately I would like to be able to do a decent > job of cancelling a voice signal. > My main question is: Is it even possible for a LMS algorithm to cancel a > quickly changing signal such as voice or is it limited only to relatively > simple signals? > > Another related question is: To increase stability would bringing the > filter order down work? > > Thanks for any help, > Zach
Reply by Maurice Givens July 25, 20032003-07-25
Zach,
If you have a configuration of the type

> > > .---------<----------. > | | > | | > v ^ > input ----.---->--------[adaptive filter]---->(+)----+---->output > | ^ > | | > | | > '------->------------------->--------' > "main channel" >
this is a form a system identification, not a bandpass-type filter (or highpass or lowpass). In this configuration, the adaptive filter will attempt to estimate the impulse response of the "main channel". If the impulse response of the "main channel" is highpass, then that's what the adap. filt. will model. Likewise lowpass or bandpass. All the adap. filt. knows how to do is minimize the squared error (if it's LMS. I also assume you are using the normalized LMS, not the straight LMS). If the length of the filter is such that the adap. filt. can not estimate the impulse response of the "main channel", then the coefficients will go toward zero, and the error will be the input signal itself. For more information about this type of configuration, look at adaptive system identification. "Zach R." <zrimkunas@verizon.net> wrote in message news:<7BjTa.54036$EZ2.3409@nwrddc01.gnilink.net>...
> Hi, > I have implemented a simple LMS algorithm w/ a 10th order filter. My > goal is to completely cancel my reference signal. I can get it to work with > a sine wave at about 75 Hz. When I try to cancel a 150 Hz signal all I get > is an unstable response. Ultimately I would like to be able to do a decent > job of cancelling a voice signal. > My main question is: Is it even possible for a LMS algorithm to cancel a > quickly changing signal such as voice or is it limited only to relatively > simple signals? > > Another related question is: To increase stability would bringing the > filter order down work? > > Thanks for any help, > Zach
Reply by Fred Marshall July 24, 20032003-07-24
"Zach R." <zrimkunas@verizon.net> wrote in message
news:wvQTa.12084$634.8067@nwrdny03.gnilink.net...
> > "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message > news:AMzTa.3404$Jk5.2403331@feed2.centurytel.net... > > > > "Zach R." <zrimkunas@verizon.net> wrote in message > > news:ZzkTa.61434$kI5.13224@nwrddc02.gnilink.net... > > > Hi, > > > The sample rate is 7040 Hz (the lowest that my ADC will go). As
far
> > as > > > the order goes, I would like it to be longer but the program takes too > > long > > > to run when I use a larger order (such as 32). Should I make a point
to
> > get > > > a higher order? How high? > > > > > > Thanks again, > > > Zach > > > > > > > > > "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message > > > news:oWjTa.3386$Jk5.2356531@feed2.centurytel.net... > > > > > > > > "Zach R." <zrimkunas@verizon.net> wrote in message > > > > news:7BjTa.54036$EZ2.3409@nwrddc01.gnilink.net... > > > > > Hi, > > > > > I have implemented a simple LMS algorithm w/ a 10th order > filter. > > > My > > > > > goal is to completely cancel my reference signal. I can get it to > > work > > > > with > > > > > a sine wave at about 75 Hz. When I try to cancel a 150 Hz signal > all > > I > > > > get > > > > > is an unstable response. Ultimately I would like to be able to do
a
> > > > decent > > > > > job of cancelling a voice signal. > > > > > My main question is: Is it even possible for a LMS algorithm
to
> > > cancel > > > > a > > > > > quickly changing signal such as voice or is it limited only to > > > relatively > > > > > simple signals? > > > > > > > > > > Another related question is: To increase stability would > bringing > > > the > > > > > filter order down work? > > > > > > > > You need to provide more information. What is the sample rate?
That
> > will > > > > determine the temporal length of the filter and other things. > > > > > > > > A length 10 filter is pretty short! > > > > > > > > Fred > > > > Zach, > > > > (As a matter of etiquette, most people don't "top post", i.e. replies go > at > > the bottom) > > > > I can provide no real advice about why your initial experiment would be
OK
> > at 75Hz and not at 150Hz - that issue raises all sorts of questions
about
> > actual signal structure, the algorithm being used, the block diagram,
bugs
> > in the code, etc. I also wonder if the implementation is > under-constrained > > by only trying to cancel a single sinusoid? It seems to be an > > overdetermined situation - that is, there are lots of filters that
happen
> to > > have amplitude and phase fixed at a single frequency. You might inject > some > > noise into the input of the filter and see what happens. > > > > It's probably best to analyze your way into the answer about length. > > > > First, let me say that I have assumed that you're using a FIR filter > > structure of length 10. So, all of these comments apply to a FIR
filter.
> > If you have an IIR LMS filter, which I'm not familiar with, then you
might
> > get better resolution / change with frequency. That said: > > > > With a sample rate of 7040Hz and a filter of length 10, the temporal > length > > of the impulse response of the filter is (1/7040)*10 = 1.42
milliseconds.
> > The reciprocal of the temporal length is a good estimate of the
frequency
> > resolution that is possible. Or, if you like, the minimum width of a > > transition band from passband to stopband or from stopband to passband. > > So, a length 10 filter at this sample rate can change value
substantially
> in > > a frequency span of 1/0.00142 = 704Hz. > > Assuming that the filter has a dc response of "x" and the next response > > value you want is "y", then you will substantially achieve "y" at around > > 700Hz. > > > > Since you're trying to cancel 75Hz or 150Hz, I assume you're trying to > make > > a bandpass filter at one of those frequencies so you can add or subtract > the > > filter output from the "main channel" and, thus, cancel the specified > > sinusoid. > > > > With a length 10 filter, about the best you can hope for is to adjust > > amplitude and phase at exactly 75Hz or at exactly 150Hz and cancel that > one > > frequency. > > Because 75 and 150 are close to zero compared to 700Hz, there won't be > much > > attenuation at 0Hz and there will only be substantial attenuation at
700Hz
> > and up to 3520Hz, which is the fs/2 frequency limit. > > This means that the filter will pass energy over a few hundred Hz in
order
> > to cancel at 75Hz or 150Hz. Energy at other frequencies below 700Hz
will
> be > > of "arbitrary" phase and substantial amplitude relative to what you
want -
> b > > ecause there's really no control over them with such a short filter. > > > > If the input were a sum of a 75Hz sinusoid and a 150Hz sinusoid and you > > wanted to cancel one but not both, and you wanted to not enhance
anything,
> > then you would need a filter that would be able to transition from pass > band > > to stop band in (150-75) = 75Hz. > > To get 75Hz resolution, you need 1/75 = 13 milliseconds of filter length > > which is 13/1.42 = 9.15 times longer than the length 10 filter or length > 92 > > or so. > > (Again, these are just arm-waving numbers - I'm not trying to be exact
and
> > could be off by a factor of 2) > > You could use one of the many filter design programs to try this to see > what > > happens. > > > > All the adaptive algorithm can do is to move things around - the > fundamental > > relationship between temporal length and frequency resolution can't be > > overcome in general. > > > > One should also suggest another aspect of this: > > > > The assumption is that there is substantial time delay between the input > and > > the output - in some sense the filter inserts a delay itself. You might > > consider the following as an alternate method if the delay is short: > > > > 1) have a broadband amplifier/attenuator instead of a filter that is > > followed by a variable delay. > > > > 2) Adjust the amplitude so cancellation can occur. > > > > 3) Adjust the delay so that cancellation does occur. > > > > I don't know what your block diagram really is. So, the delay here may > have > > to be in the "main channel" instead of in the cancellation channel for > this > > to work. Maybe you can do that and maybe you can't. The idea is to > simply > > match up the two channels in time and in amplitude for perfect > cancellation. > > > > Another way to look at this is it's just an adaptive filter with all > > coefficients zero except one. .... but it does require that the delays
can
> > be matched. If this can work, it can cancel noiselike signals as well
as
> > sinusoids. > > > > This is all a prelude to your real objective which is to cancel speech. > > That implies a couple of issues: > > > > 1) Speech has noiselike components. A typical adaptive filter will
shut
> > off at frequencies where there's noise (unless there is temporal
matching
> > and, thus, correlated noise). > > > > 2) Speech moves all over the place in frequency and I don't think you
can
> > guarantee a phase relationship between frequencies that will remain. > > So, the adaptive filter would have to adapt very quickly in order to > adjust > > for the new signal. > > Also, the adaptive filter would have to have pretty fine resolution - be
a
> > long filter. > > > > I don't know that this can work. But then, I don't understand the block > > diagram of what you're needing / wanting to implement. > > > > Here's the block diagram I've had in mind in the discussion above: > > > > > > .---------<----------. > > | | > > | | > > v ^ > > input ----.---->--------[adaptive filter]---->(+)----+---->output > > | ^ > > | | > > | | > > '------->------------------->--------' > > "main channel" > > > > Fred > > > > > > > > > > Fred, > Thanks for the information it has definitely helped me in the > understanding of the LMS. As a clarification, are you saying that I will > most likely be able to see attenuation at frequencies above 704 Hz and
below
> fs/2 Hz? By any means I'll try some of those frequencies out (as sin
waves)
> and see what I get. > I guess what my main goal should be is to extend this filter length. > From what you have written it seems that having a longer filter definitely > makes life easier. Thanks again, > Zach
Zach, A qualified yes. What I was trying to convey was this: A length 10 filter with sample rate of 7040kHz will be *capable* of being designed with this response. It all depends on the filter coefficients / design that you evaluate. So,if your particular algorithm converges to a filter like the one you describe above, then it will have the attenuation you describe - by definition really. Remember, I said these are arm-waving rules of thumb! If you go to: http://www.nauticom.net/www/jdtaft/fir.htm you can design lowpass filters of length 10. Here frequency "0.5" corresponds to your 3520kHz or fs/2 So 704Hz would be 0.1. If you design a lowpass with cutoff at 0.1, the attenuation will be about what the filter is capable of doing. If you gradually reduce the bandwidth in steps of .01, you will see the attenuation get worse. If you design a bandpass with center frequency of 0.25, the attenuation will also be about what the filter is capable of doing. It will have 3dB down points at roughly 0.2 and 0.3 which is 0.1 - the "resolution" or transition width that a length 10 filter will provide. As the bandwidth for a bandpass approaches 0.2 or as the band limit for a lowpass approaches 0.1, then the attenuation will become "reasonable" - more like 15dB. For bandwidth specifications less than this the attenuation will be not as good. All an adaptive filter can do is get close to these same responses - depending on what you give it to work with and the algorithm you're using. The adaptive filter can't do better in absolute terms. However, this point confuses some folks. The adaptive filter *can* do better than a specifically-designed filter *at any moment* because it does adapt - whereas a hard-designed filter only does one thing. Knowing what the hard-designed filters can do give you insight into what an adaptive filter can also do in a stylized "best case" context. I hope this helps. Fred
Reply by Zach R. July 24, 20032003-07-24
"Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message
news:AMzTa.3404$Jk5.2403331@feed2.centurytel.net...
> > "Zach R." <zrimkunas@verizon.net> wrote in message > news:ZzkTa.61434$kI5.13224@nwrddc02.gnilink.net... > > Hi, > > The sample rate is 7040 Hz (the lowest that my ADC will go). As far > as > > the order goes, I would like it to be longer but the program takes too > long > > to run when I use a larger order (such as 32). Should I make a point to > get > > a higher order? How high? > > > > Thanks again, > > Zach > > > > > > "Fred Marshall" <fmarshallx@remove_the_x.acm.org> wrote in message > > news:oWjTa.3386$Jk5.2356531@feed2.centurytel.net... > > > > > > "Zach R." <zrimkunas@verizon.net> wrote in message > > > news:7BjTa.54036$EZ2.3409@nwrddc01.gnilink.net... > > > > Hi, > > > > I have implemented a simple LMS algorithm w/ a 10th order
filter.
> > My > > > > goal is to completely cancel my reference signal. I can get it to > work > > > with > > > > a sine wave at about 75 Hz. When I try to cancel a 150 Hz signal
all
> I > > > get > > > > is an unstable response. Ultimately I would like to be able to do a > > > decent > > > > job of cancelling a voice signal. > > > > My main question is: Is it even possible for a LMS algorithm to > > cancel > > > a > > > > quickly changing signal such as voice or is it limited only to > > relatively > > > > simple signals? > > > > > > > > Another related question is: To increase stability would
bringing
> > the > > > > filter order down work? > > > > > > You need to provide more information. What is the sample rate? That > will > > > determine the temporal length of the filter and other things. > > > > > > A length 10 filter is pretty short! > > > > > > Fred > > Zach, > > (As a matter of etiquette, most people don't "top post", i.e. replies go
at
> the bottom) > > I can provide no real advice about why your initial experiment would be OK > at 75Hz and not at 150Hz - that issue raises all sorts of questions about > actual signal structure, the algorithm being used, the block diagram, bugs > in the code, etc. I also wonder if the implementation is
under-constrained
> by only trying to cancel a single sinusoid? It seems to be an > overdetermined situation - that is, there are lots of filters that happen
to
> have amplitude and phase fixed at a single frequency. You might inject
some
> noise into the input of the filter and see what happens. > > It's probably best to analyze your way into the answer about length. > > First, let me say that I have assumed that you're using a FIR filter > structure of length 10. So, all of these comments apply to a FIR filter. > If you have an IIR LMS filter, which I'm not familiar with, then you might > get better resolution / change with frequency. That said: > > With a sample rate of 7040Hz and a filter of length 10, the temporal
length
> of the impulse response of the filter is (1/7040)*10 = 1.42 milliseconds. > The reciprocal of the temporal length is a good estimate of the frequency > resolution that is possible. Or, if you like, the minimum width of a > transition band from passband to stopband or from stopband to passband. > So, a length 10 filter at this sample rate can change value substantially
in
> a frequency span of 1/0.00142 = 704Hz. > Assuming that the filter has a dc response of "x" and the next response > value you want is "y", then you will substantially achieve "y" at around > 700Hz. > > Since you're trying to cancel 75Hz or 150Hz, I assume you're trying to
make
> a bandpass filter at one of those frequencies so you can add or subtract
the
> filter output from the "main channel" and, thus, cancel the specified > sinusoid. > > With a length 10 filter, about the best you can hope for is to adjust > amplitude and phase at exactly 75Hz or at exactly 150Hz and cancel that
one
> frequency. > Because 75 and 150 are close to zero compared to 700Hz, there won't be
much
> attenuation at 0Hz and there will only be substantial attenuation at 700Hz > and up to 3520Hz, which is the fs/2 frequency limit. > This means that the filter will pass energy over a few hundred Hz in order > to cancel at 75Hz or 150Hz. Energy at other frequencies below 700Hz will
be
> of "arbitrary" phase and substantial amplitude relative to what you want -
b
> ecause there's really no control over them with such a short filter. > > If the input were a sum of a 75Hz sinusoid and a 150Hz sinusoid and you > wanted to cancel one but not both, and you wanted to not enhance anything, > then you would need a filter that would be able to transition from pass
band
> to stop band in (150-75) = 75Hz. > To get 75Hz resolution, you need 1/75 = 13 milliseconds of filter length > which is 13/1.42 = 9.15 times longer than the length 10 filter or length
92
> or so. > (Again, these are just arm-waving numbers - I'm not trying to be exact and > could be off by a factor of 2) > You could use one of the many filter design programs to try this to see
what
> happens. > > All the adaptive algorithm can do is to move things around - the
fundamental
> relationship between temporal length and frequency resolution can't be > overcome in general. > > One should also suggest another aspect of this: > > The assumption is that there is substantial time delay between the input
and
> the output - in some sense the filter inserts a delay itself. You might > consider the following as an alternate method if the delay is short: > > 1) have a broadband amplifier/attenuator instead of a filter that is > followed by a variable delay. > > 2) Adjust the amplitude so cancellation can occur. > > 3) Adjust the delay so that cancellation does occur. > > I don't know what your block diagram really is. So, the delay here may
have
> to be in the "main channel" instead of in the cancellation channel for
this
> to work. Maybe you can do that and maybe you can't. The idea is to
simply
> match up the two channels in time and in amplitude for perfect
cancellation.
> > Another way to look at this is it's just an adaptive filter with all > coefficients zero except one. .... but it does require that the delays can > be matched. If this can work, it can cancel noiselike signals as well as > sinusoids. > > This is all a prelude to your real objective which is to cancel speech. > That implies a couple of issues: > > 1) Speech has noiselike components. A typical adaptive filter will shut > off at frequencies where there's noise (unless there is temporal matching > and, thus, correlated noise). > > 2) Speech moves all over the place in frequency and I don't think you can > guarantee a phase relationship between frequencies that will remain. > So, the adaptive filter would have to adapt very quickly in order to
adjust
> for the new signal. > Also, the adaptive filter would have to have pretty fine resolution - be a > long filter. > > I don't know that this can work. But then, I don't understand the block > diagram of what you're needing / wanting to implement. > > Here's the block diagram I've had in mind in the discussion above: > > > .---------<----------. > | | > | | > v ^ > input ----.---->--------[adaptive filter]---->(+)----+---->output > | ^ > | | > | | > '------->------------------->--------' > "main channel" > > Fred > > > >
Fred, Thanks for the information it has definitely helped me in the understanding of the LMS. As a clarification, are you saying that I will most likely be able to see attenuation at frequencies above 704 Hz and below fs/2 Hz? By any means I'll try some of those frequencies out (as sin waves) and see what I get. I guess what my main goal should be is to extend this filter length. From what you have written it seems that having a longer filter definitely makes life easier. Thanks again, Zach