DSPRelated.com
Forums

Newbie Matlab Digital Filter / Feedback Question

Started by j26 January 13, 2011
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
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
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