DSPRelated.com
Forums

IIR filter - sample instants to flush out existing data

Started by Madhu April 5, 2007
Hi,

I have a question on IIR filters. I have an IIR filter running on a
TMS DSP.

Suppose I have an FIR filter with 'a' taps. If the filter is running
and I want to flush the existing data at each of the taps out, it
would take me 'a' sample instants. Is that correct?
Now, if I have an IIR filter with 'a' feedforward and 'b' feedback
taps, roughly how many sample instants would it take before I could
safely say that the filter has been flushed off all previous samples?
i.e. how long before I can say that the filter o/p is due to the new
input data?

In theory, due to the feedback paths, it would take me infinitely
long. But is there a reasonable approximation for the number of sample
instants I can arrive at?

Any inputs on how I go about calculating the approximate number of
sample instants (through matlab code etc.) would be greatly
appreciated.

Thank you,
Madhu

On Apr 5, 5:11 pm, "Madhu" <balding_spald...@inbox.com> wrote:
> Hi, > > I have a question on IIR filters. I have an IIR filter running on a > TMS DSP. > > Suppose I have an FIR filter with 'a' taps. If the filter is running > and I want to flush the existing data at each of the taps out, it > would take me 'a' sample instants. Is that correct? > Now, if I have an IIR filter with 'a' feedforward and 'b' feedback > taps, roughly how many sample instants would it take before I could > safely say that the filter has been flushed off all previous samples? > i.e. how long before I can say that the filter o/p is due to the new > input data? > > In theory, due to the feedback paths, it would take me infinitely > long. But is there a reasonable approximation for the number of sample > instants I can arrive at? > > Any inputs on how I go about calculating the approximate number of > sample instants (through matlab code etc.) would be greatly > appreciated. > > Thank you, > Madhu
It depends on the impulse response of the filter. If you think of each sample you put in as an impulse, the decay time of the impulse response to an insignificant level is how long that sample influences the output. John
Madhu wrote:
> Hi, > > I have a question on IIR filters. I have an IIR filter running on a > TMS DSP. > > Suppose I have an FIR filter with 'a' taps. If the filter is running > and I want to flush the existing data at each of the taps out, it > would take me 'a' sample instants. Is that correct?
Why do you need to "flush" the filter instead of zeroing all the data memory at once?
> Now, if I have an IIR filter with 'a' feedforward and 'b' feedback > taps, roughly how many sample instants would it take before I could > safely say that the filter has been flushed off all previous samples? > i.e. how long before I can say that the filter o/p is due to the new > input data? > > In theory, due to the feedback paths, it would take me infinitely > long. But is there a reasonable approximation for the number of sample > instants I can arrive at?
It depends on the length of the impulse response, but you are at liberty to set all the storage elements to zero (or any other suitable initial condition) as fast as you can address the storage elements.
> Any inputs on how I go about calculating the approximate number of > sample instants (through matlab code etc.) would be greatly > appreciated.
If this is a practical question, don't bother to flush it; bash it. Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
On 2007-04-05, Madhu <balding_spalding@inbox.com> wrote:
> > Any inputs on how I go about calculating the approximate number of > sample instants (through matlab code etc.) would be greatly > appreciated.
Others already told you to look at the sample response. In Matlab you can do that with impz. Someone mentioned 'smashing' the values as a practical solution, but there's still the question of how long after you start feeding real data into an IIR filter before the output is not strongly affected by the startup conditions. -- Ben Jackson AD7GD <ben@ben.com> http://www.ben.com/
Madhu wrote:

> I have a question on IIR filters. I have an IIR filter running on a > TMS DSP. > > Suppose I have an FIR filter with 'a' taps. If the filter is running > and I want to flush the existing data at each of the taps out, it > would take me 'a' sample instants. Is that correct?
Yes.
> Now, if I have an IIR filter with 'a' feedforward and 'b' feedback > taps, roughly how many sample instants would it take before I could > safely say that the filter has been flushed off all previous samples? > i.e. how long before I can say that the filter o/p is due to the new > input data? > > In theory, due to the feedback paths, it would take me infinitely > long. But is there a reasonable approximation for the number of sample > instants I can arrive at?
As Jerry suggests, zeroing-out the filter's memory might be the best option in many applications. However, to answer your question specifically, what I would do is: 1) Determine a threshold at which you deem the filter to be flushed out. For example, if your full-scale input is 1.0, you might set 1.0e-6 as the threshold. 2) Zero all memory elements, put in a full-scale impulse, and run the filter until the magnitude of the output is less than the threshold for some number of samples, N. This procedure allows you to set set a practical limit on the IIR filter's otherwise "infinite" impulse response. The value of threshold and N are empirical values that you must determine relative to your application. =g2
Madhu wrote:

> I have a question on IIR filters. I have an IIR filter running on a > TMS DSP. > > Suppose I have an FIR filter with 'a' taps. If the filter is running > and I want to flush the existing data at each of the taps out, it > would take me 'a' sample instants. Is that correct?
Yes.
> Now, if I have an IIR filter with 'a' feedforward and 'b' feedback > taps, roughly how many sample instants would it take before I could > safely say that the filter has been flushed off all previous samples? > i.e. how long before I can say that the filter o/p is due to the new > input data? > > In theory, due to the feedback paths, it would take me infinitely > long. But is there a reasonable approximation for the number of sample > instants I can arrive at?
As Jerry suggests, zeroing-out the filter's memory might be the best option in many applications. However, to answer your question specifically, what I would do is: 1) Determine a threshold at which you deem the filter to be flushed out. For example, if your full-scale input is 1.0, you might set 1.0e-6 as the threshold. 2) Zero all memory elements, put in a full-scale impulse, and run the filter until the magnitude of the output is less than the threshold for some number of samples, N. This procedure allows you to set set a practical limit on the IIR filter's otherwise "infinite" impulse response. The value of threshold and N are empirical values that you must determine relative to your application. =g2
Grant Griffin wrote:
...

Sorry for the double reply...haven't used this darn thing for awhile. ;-)

=g2

Grant Griffin wrote:
> Grant Griffin wrote: > ... > > Sorry for the double reply...haven't used this darn thing for awhile. ;-)
Grant, I'm delighted that you're using it now. How's the 12-step program coming? :-) Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
Jerry Avins wrote:
> Grant Griffin wrote: >> Grant Griffin wrote: >> ... >> >> Sorry for the double reply...haven't used this darn thing for awhile. ;-) > > Grant, > > I'm delighted that you're using it now. How's the 12-step program > coming? :-)
Thanks, Jerry. :-) Actually, I think I'm doing better than most addicts ever could hope: I seem to be able to imbibe every once and awhile, yet not get addicted again. That said, I'm glad to see that you, r b-j, Eric, Rick, Randy, et. al. (sorry if I've left anybody out--those are just the old friends I've seen here lately) have never succeeded at all 12 steps. ;-) =g2 _____________________________________________________________________ Grant R. Griffin Publisher of dspGuru http://www.dspguru.com Iowegian International Corporation http://www.iowegian.com See http://www.iowegian.com/img/contact.gif for e-mail address
Thanks for your inputs, everyone. I will let you guys know how things
go.

Thanks,
Madhu