Reply by Tim Wescott January 14, 20112011-01-14
On 01/14/2011 02:20 AM, glen herrmannsfeldt wrote:
> Tim Wescott<tim@seemywebsite.com> wrote: > (snip, someone wrote) > >>> It seems you want the impossible, e.g., to design a filter >>> that a) doesn't allow fast changes (i.e., smooths) and b) >>> that allows fast changes. > >> But to not allow fast changes _when the input is stable_ but >> allow them _when the input jumps_ -- that's not only possible, >> that's a nonlinear filter. > > Somehow this reminds me of non-linear (also called non-Newtonian) > fluids, a favorite example being cornstarch in water. > > (If you put non-linear cornstarch into Google, you should find it.) > > Now, how does the filter know which are the big jumps and > which are the small ones?
You've just put your finger on why there aren't more nonlinear filters in the world.
> Maybe another example of non-linear filter is the DBX noise > reduction system. The signal goes through an amplifier which > has a gain that is a function of the previous values of the > signal, with some carefully selected time constants.
And given an example of a working nonlinear filter. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by glen herrmannsfeldt January 14, 20112011-01-14
Tim Wescott <tim@seemywebsite.com> wrote:
(snip, someone wrote)

>> It seems you want the impossible, e.g., to design a filter >> that a) doesn't allow fast changes (i.e., smooths) and b) >> that allows fast changes.
> But to not allow fast changes _when the input is stable_ but > allow them _when the input jumps_ -- that's not only possible, > that's a nonlinear filter.
Somehow this reminds me of non-linear (also called non-Newtonian) fluids, a favorite example being cornstarch in water. (If you put non-linear cornstarch into Google, you should find it.) Now, how does the filter know which are the big jumps and which are the small ones? Maybe another example of non-linear filter is the DBX noise reduction system. The signal goes through an amplifier which has a gain that is a function of the previous values of the signal, with some carefully selected time constants. Hmmm. -- glen
Reply by Chris Bore January 14, 20112011-01-14
On Jan 13, 1:44&#4294967295;pm, "j26" <ptd26@n_o_s_p_a_m.live.com> wrote:
> I am trying to use a filter to smooth time-series data. &#4294967295;Although it's been > a good 5 years since my last signal and systems / control systems course, I > have recently started experimenting with the butter and cheby2 filter > design functions in Octave. &#4294967295;I have a filter that smooths the input data > well (low-order / low cutoff frequency), but sometimes when the input > changes abruptly, the output cannot keep up (I know I could raise the order > of the filter / raise cutoff frequency to improve response, but that > sacrifices smoothness). &#4294967295;How do I apply feedback to my filter such that the > output follows the input closer when there are large changes in input? &#4294967295;I > basically want to take my filter and add on a factor equal to the > difference between the input and output. &#4294967295;I remember that there was a > function called feedback for the continuous time case, but don't recall how > to apply feedback to a discrete time filter.
Three comments: 1) if your goal is that the output 'follow' the input 'faster' then you may not need feedback - you need to design an appropriate filter either by specifying its frequency spectrum (eg higher cut-ff might make it follow whatever it has to follow faster) or by specifying its impulse or step response (which is the same thing in the 'time' domain but may let you specify in a way closer to your goal). 2) an IIR filter is already recursive - that is, it uses feedback. Sof f you really need feedback then you can achieve that in a readily understandable way by designing your filter see (1) above. 3) 'smoothing' is not necessarily filtering in the sense of filter that is often assumed in DSP (ie a linear filter). Octave has many functions that can assist you in smoothing in different ways, but they tend not to be as simple as linear filters to understand their effect. Try downloading some of the Octave additional libraries: http://octave.sourceforge.net/packages.php There is one specifically for 'data smoothing' whatever that means. .. :-) Chris --- Chris Bore BORES Signal Processing www.bores.com
Reply by Tim Wescott January 14, 20112011-01-14
On 01/13/2011 11:15 PM, Randy Yates wrote:
> On 01/14/2011 01:40 AM, j26 wrote: >>> On 01/13/2011 09:02 PM, Tim Wescott wrote: >>>> [...] >>>> The whole field of linear systems is this wonderful exact science that >> has absolutely no example in the real world. There are >>>> systems that come awfully close -- but there aren't really _any_ linear >> systems in the real world. >>> >>> Sure, just as there aren't really any straight lines, round circles, >>> quiet >> rooms, >>> pure colors, etc. >>> -- >>> Randy Yates % "My Shangri-la has gone away, fading >> like >>> Digital Signal Labs % the Beatles on 'Hey Jude'" >>> yates@digitalsignallabs.com % >>> http://www.digitalsignallabs.com % 'Shangri-La', *A New World Record*, >> ELO >>> >> >> I appreciate all the advice. Can anyone recommend a book relevant to >> using >> non-linear filters for filtering time series data? Otherwise, I plan to >> buy this book: >> >> http://www.powells.com/biblio/62-9780123725363-1 >> >> ..Hope that's the right place to start. > > It seems you want the impossible, e.g., to design a filter > that a) doesn't allow fast changes (i.e., smooths) and b) > that allows fast changes.
But to not allow fast changes _when the input is stable_ but allow them _when the input jumps_ -- that's not only possible, that's a nonlinear filter. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by Randy Yates January 14, 20112011-01-14
On 01/14/2011 01:40 AM, j26 wrote:
>> On 01/13/2011 09:02 PM, Tim Wescott wrote: >>> [...] >>> The whole field of linear systems is this wonderful exact science that > has absolutely no example in the real world. There are >>> systems that come awfully close -- but there aren't really _any_ linear > systems in the real world. >> >> Sure, just as there aren't really any straight lines, round circles, quiet > rooms, >> pure colors, etc. >> -- >> Randy Yates % "My Shangri-la has gone away, fading > like >> Digital Signal Labs % the Beatles on 'Hey Jude'" >> yates@digitalsignallabs.com % >> http://www.digitalsignallabs.com % 'Shangri-La', *A New World Record*, > ELO >> > > I appreciate all the advice. Can anyone recommend a book relevant to using > non-linear filters for filtering time series data? Otherwise, I plan to > buy this book: > > http://www.powells.com/biblio/62-9780123725363-1 > > ..Hope that's the right place to start.
It seems you want the impossible, e.g., to design a filter that a) doesn't allow fast changes (i.e., smooths) and b) that allows fast changes. -- Randy Yates % "My Shangri-la has gone away, fading like Digital Signal Labs % the Beatles on 'Hey Jude'" yates@digitalsignallabs.com % http://www.digitalsignallabs.com % 'Shangri-La', *A New World Record*, ELO
Reply by j26 January 14, 20112011-01-14
>On 01/13/2011 09:02 PM, Tim Wescott wrote: >> [...] >> The whole field of linear systems is this wonderful exact science that
has absolutely no example in the real world. There are
>> systems that come awfully close -- but there aren't really _any_ linear
systems in the real world.
> >Sure, just as there aren't really any straight lines, round circles, quiet
rooms,
>pure colors, etc. >-- >Randy Yates % "My Shangri-la has gone away, fading
like
>Digital Signal Labs % the Beatles on 'Hey Jude'" >yates@digitalsignallabs.com % >http://www.digitalsignallabs.com % 'Shangri-La', *A New World Record*,
ELO
>
I appreciate all the advice. Can anyone recommend a book relevant to using non-linear filters for filtering time series data? Otherwise, I plan to buy this book: http://www.powells.com/biblio/62-9780123725363-1 ..Hope that's the right place to start.
Reply by Randy Yates January 13, 20112011-01-13
On 01/13/2011 09:02 PM, Tim Wescott wrote:
> [...] > The whole field of linear systems is this wonderful exact science that has absolutely no example in the real world. There are > systems that come awfully close -- but there aren't really _any_ linear systems in the real world.
Sure, just as there aren't really any straight lines, round circles, quiet rooms, pure colors, etc. -- Randy Yates % "My Shangri-la has gone away, fading like Digital Signal Labs % the Beatles on 'Hey Jude'" yates@digitalsignallabs.com % http://www.digitalsignallabs.com % 'Shangri-La', *A New World Record*, ELO
Reply by Tim Wescott January 13, 20112011-01-13
On 01/13/2011 04:38 PM, Rob Gaddi wrote:
> On 1/13/2011 4:34 PM, j26 wrote: >> Tom, I really appreciate your responses. When I asked the question >> earlier >> about a non-linear filter having variable bandwidth vs. variable gain, I >> was thinking that the essential characteristic of a non-linear filter is >> the variable bandwidth -- it's frequency response changes based upon the >> input signal. Although, after thinking about it some more, that's the >> same >> thing as variable gain (the gain applied to each frequency changes >> based on >> input signal). Earlier, I was thinking that gain was more analogous to >> the >> order of the filter. >> >> Limiting / lowering the cutoff frequency of a low-pass filter will >> produce >> a smoother output signal although it will not track the output signal as >> closely. In my original post, I was thinking about compensating for this >> by having a correction factor proportional to the difference (essentially >> applying feedback to the filter). But upon thinking about this some more, >> that can't be exactly what I need either because every linear feedback >> system composed of multiple transfer functions can be described with a >> single transfer function. But non-linear rather than linear feedback >> sounds like what I'm after. >> >> I'm not surprised that non-linear filter design is more of a >> trial-and-error art rather than a science. The tuning or optimizing of >> coefficients sounds like a good use for genetic algorithms. > > That's a fairly limited definition of non-linear filtering. There are > also things like median filtering that really can't be understood as a > variation on the standard FIR/IIR concepts. >
Yup. In fact, in general you have to toss concepts like "bandwidth" and "gain" out the window when you're dealing with nonlinear systems. Not always -- which is part of the reason that nonlinear filter design can get weird -- but you can't count on the terms meaning anything. The whole field of linear systems is this wonderful exact science that has absolutely no example in the real world. There are systems that come awfully close -- but there aren't really _any_ linear systems in the real world. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by Rob Gaddi January 13, 20112011-01-13
On 1/13/2011 4:34 PM, j26 wrote:
> Tom, I really appreciate your responses. When I asked the question earlier > about a non-linear filter having variable bandwidth vs. variable gain, I > was thinking that the essential characteristic of a non-linear filter is > the variable bandwidth -- it's frequency response changes based upon the > input signal. Although, after thinking about it some more, that's the same > thing as variable gain (the gain applied to each frequency changes based on > input signal). Earlier, I was thinking that gain was more analogous to the > order of the filter. > > Limiting / lowering the cutoff frequency of a low-pass filter will produce > a smoother output signal although it will not track the output signal as > closely. In my original post, I was thinking about compensating for this > by having a correction factor proportional to the difference (essentially > applying feedback to the filter). But upon thinking about this some more, > that can't be exactly what I need either because every linear feedback > system composed of multiple transfer functions can be described with a > single transfer function. But non-linear rather than linear feedback > sounds like what I'm after. > > I'm not surprised that non-linear filter design is more of a > trial-and-error art rather than a science. The tuning or optimizing of > coefficients sounds like a good use for genetic algorithms.
That's a fairly limited definition of non-linear filtering. There are also things like median filtering that really can't be understood as a variation on the standard FIR/IIR concepts. -- Rob Gaddi, Highland Technology Email address is currently out of order
Reply by j26 January 13, 20112011-01-13
Tom, I really appreciate your responses.  When I asked the question earlier
about a non-linear filter having variable bandwidth vs. variable gain, I
was thinking that the essential characteristic of a non-linear filter is
the variable bandwidth -- it's frequency response changes based upon the
input signal.  Although, after thinking about it some more, that's the same
thing as variable gain (the gain applied to each frequency changes based on
input signal).  Earlier, I was thinking that gain was more analogous to the
order of the filter.

Limiting / lowering the cutoff frequency of a low-pass filter will produce
a smoother output signal although it will not track the output signal as
closely.  In my original post, I was thinking about compensating for this
by having a correction factor proportional to the difference (essentially
applying feedback to the filter).  But upon thinking about this some more,
that can't be exactly what I need either because every linear feedback
system composed of multiple transfer functions can be described with a
single transfer function.  But non-linear rather than linear feedback
sounds like what I'm after.  

I'm not surprised that non-linear filter design is more of a
trial-and-error art rather than a science.  The tuning or optimizing of
coefficients sounds like a good use for genetic algorithms.