DSPRelated.com
Forums

IIR filter Implementation

Started by Par May 3, 2005
Hello Guys!

I have a brief signal, about 100 values, having unknown frequency
components including a single frequency of interest to me. I have designed
an IIR filter using MATLAB that will filter out the single frequency.

However, since the signal is brief, I face the problem that the filter has
a non-zero transient response while handling most of my signal. This causes
 weird results.

Will it help if I pass a long sinusoid of the passband frequency before
passing my signal? Is this a good way of preventing the transient response
from affecting the filtering?

Thanks a million!

--- Par.


		
This message was sent using the Comp.DSP web interface on
www.DSPRelated.com
"Par" <rpara26@yahoo.com> wrote in message 
news:m8edneNpZsC_lOXfRVn-oA@giganews.com...
> Hello Guys! > > I have a brief signal, about 100 values, having unknown frequency > components including a single frequency of interest to me. I have designed > an IIR filter using MATLAB that will filter out the single frequency. > > However, since the signal is brief, I face the problem that the filter has > a non-zero transient response while handling most of my signal. This > causes > weird results. > > Will it help if I pass a long sinusoid of the passband frequency before > passing my signal? Is this a good way of preventing the transient response > from affecting the filtering? > > Thanks a million! > > --- Par.
No. Superposition applies. So, there will be the same transient due to any new signal that is applied to the input. If the proposed signal is the same frequency as the desired to-be-detected signal then you would have to figure out some way to separate them. The transient would affect the detection / separation process. So, it's not going to help and will probably hinder. Fred
> >"Par" <rpara26@yahoo.com> wrote in message >news:m8edneNpZsC_lOXfRVn-oA@giganews.com... >> Hello Guys! >> >> I have a brief signal, about 100 values, having unknown frequency >> components including a single frequency of interest to me. I have
designed
>> an IIR filter using MATLAB that will filter out the single frequency. >> >> However, since the signal is brief, I face the problem that the filter
has
>> a non-zero transient response while handling most of my signal. This >> causes >> weird results. >> >> Will it help if I pass a long sinusoid of the passband frequency
before
>> passing my signal? Is this a good way of preventing the transient
response
>> from affecting the filtering? >> >> Thanks a million! >> >> --- Par. > >No. Superposition applies. So, there will be the same transient due to
any
>new signal that is applied to the input. If the proposed signal is the
same
>frequency as the desired to-be-detected signal then you would have to
figure
>out some way to separate them. The transient would affect the detection
/
>separation process. So, it's not going to help and will probably
hinder.
> >Fred > > >
Fred, Yeah ... I get it. So, do you know what is generally done to settle an IIR filter? This might be a common requirement while using IIR filters, and so, are there any popular ways of settling an IIR filter before passing the desired signal through it? Any suggestion will really help me solve this problem. Thanks. --- Par. This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Par wrote:

>>"Par" <rpara26@yahoo.com> wrote in message >>news:m8edneNpZsC_lOXfRVn-oA@giganews.com... >> >>>Hello Guys! >>> >>>I have a brief signal, about 100 values, having unknown frequency >>>components including a single frequency of interest to me. I have > > designed > >>>an IIR filter using MATLAB that will filter out the single frequency. >>> >>>However, since the signal is brief, I face the problem that the filter > > has > >>>a non-zero transient response while handling most of my signal. This >>>causes >>>weird results. >>> >>>Will it help if I pass a long sinusoid of the passband frequency > > before > >>>passing my signal? Is this a good way of preventing the transient > > response > >>>from affecting the filtering? >>> >>>Thanks a million! >>> >>>--- Par. >> >>No. Superposition applies. So, there will be the same transient due to > > any > >>new signal that is applied to the input. If the proposed signal is the > > same > >>frequency as the desired to-be-detected signal then you would have to > > figure > >>out some way to separate them. The transient would affect the detection > > / > >>separation process. So, it's not going to help and will probably > > hinder. > >>Fred >> >> >> > > > Fred, > > Yeah ... I get it. So, do you know what is generally done to settle an IIR > filter? > > This might be a common requirement while using IIR filters, and so, are > there any popular ways of settling an IIR filter before passing the > desired signal through it? > > Any suggestion will really help me solve this problem. > > Thanks. > > --- Par. >
Normally an IIR just not the thing to use in a situation like yours: a finite chuck of data really calls for a finite (and probably same-sized) FIR filter. I don't think there is a way of "pre settling" a filter that doesn't involve knowing the signal that you're trying to identify -- and then you wouldn't need to mess with this DSP folderol! -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
"Par" <rpara26@yahoo.com> wrote in message
news:m8edneNpZsC_lOXfRVn-oA@giganews.com...
> Hello Guys! > > I have a brief signal, about 100 values, having unknown
frequency
> components including a single frequency of interest to me.
I have designed
> an IIR filter using MATLAB that will filter out the single
frequency.
> > However, since the signal is brief, I face the problem
that the filter has
> a non-zero transient response while handling most of my
signal. This causes
> weird results. >
Have you considered maintaining a "pre-trigger" buffer similar to what is done in high-quality oscilloscopes?
"John E. Hadstate" <jh113355@hotmail.com> wrote in message 
news:qjUde.33$rr.15@bignews1.bellsouth.net...
> > "Par" <rpara26@yahoo.com> wrote in message > news:m8edneNpZsC_lOXfRVn-oA@giganews.com... >> Hello Guys! >> >> I have a brief signal, about 100 values, having unknown > frequency >> components including a single frequency of interest to me. > I have designed >> an IIR filter using MATLAB that will filter out the single > frequency. >> >> However, since the signal is brief, I face the problem > that the filter has >> a non-zero transient response while handling most of my > signal. This causes >> weird results. >> > > Have you considered maintaining a "pre-trigger" buffer > similar to what is done in high-quality oscilloscopes?
That would still require that a "trigger" be fired. Delaying the signal so that more of it will be "seen" isn't the issue. Fred
"Par" <rpara26@yahoo.com> wrote in message 
news:LI6dnYKgINDFkuXfRVn-1w@giganews.com...
> > >>"Par" <rpara26@yahoo.com> wrote in message >>news:m8edneNpZsC_lOXfRVn-oA@giganews.com... >>> Hello Guys! >>> >>> I have a brief signal, about 100 values, having unknown frequency >>> components including a single frequency of interest to me. I have > designed >>> an IIR filter using MATLAB that will filter out the single frequency. >>> >>> However, since the signal is brief, I face the problem that the filter > has >>> a non-zero transient response while handling most of my signal. This >>> causes >>> weird results. >>> >>> Will it help if I pass a long sinusoid of the passband frequency > before >>> passing my signal? Is this a good way of preventing the transient > response >>> from affecting the filtering? >>> >>> Thanks a million! >>> >>> --- Par. >> >>No. Superposition applies. So, there will be the same transient due to > any >>new signal that is applied to the input. If the proposed signal is the > same >>frequency as the desired to-be-detected signal then you would have to > figure >>out some way to separate them. The transient would affect the detection > / >>separation process. So, it's not going to help and will probably > hinder. >> >>Fred >> >> >> > > Fred, > > Yeah ... I get it. So, do you know what is generally done to settle an IIR > filter? > > This might be a common requirement while using IIR filters, and so, are > there any popular ways of settling an IIR filter before passing the > desired signal through it? >
"Settling" the filter applies to all individual inputs. Thus my remark about *superposition*. It cannot be done. There is nothing that can "settle" a filter for an input that has not yet occurred. If there were, that would be predicting the future. Your issue is more the length of the transient response of the filter. Try a minimum phase FIR (or maybe IIR) filter if you want quickest response. Be aware that a filter of bandwidth B will settle in roughly 1/B seconds. There is no getting away from this. You may have conflicting requirements: - you have a "brief" signal which apparently is a sinusoidal burst. The fact that it's a burst forces it to have lots of high frequency content. - you want to filter out as much noise as possible. This will smooth the edges of the burst if the bandwidth is too narrow. If the filter is way too narrow you may not see the burst at all! Back to predicting the future: +--------------------+ | | | | | | input------+---------------------|------------>(+)----+----> e[n] | | ^ | | | | v | +----[delay here?]->[LMS]------------+----------> o[n] Adaptive enhancer LMS adaptive filter adjusts to minimize e[n] which cancels signal and adds no additional noise. o[n] ideally contains only signal If you put a big delay in the path to the LMS filter, then the LMS filter is forced to cancel e[n] using "old" data from the input. After the LMS filter has settled out, if the delay is removed, the LMS filter predicts the future of the input doesn't it? The problem is that the signals need to be relatively steady-state for this to work and all the LMS filter does is modify amplitude and phase at any frequency - 'cause after all it's just a filter isn't it? Adding the delay at the input to the LMS filter modifies the input phase linearly with no amplitude change. Removing the delay from the input of the LMS filter just advances the phase at the output from the LMS filter. No free lunch. Fred
In article <WM6dncA2R7sAhOXfRVn-jw@centurytel.net>,
Fred Marshall <fmarshallx@remove_the_x.acm.org> wrote:
> >"Par" <rpara26@yahoo.com> wrote in message >news:LI6dnYKgINDFkuXfRVn-1w@giganews.com... >> > >>>"Par" <rpara26@yahoo.com> wrote in message >>>news:m8edneNpZsC_lOXfRVn-oA@giganews.com... >>>> Hello Guys! >>>> >>>> I have a brief signal, about 100 values, having unknown frequency >>>> components including a single frequency of interest to me. I have >> designed >>>> an IIR filter using MATLAB that will filter out the single frequency. >>>> >>>> However, since the signal is brief, I face the problem that the filter >> has >>>> a non-zero transient response while handling most of my signal. This >>>> causes >>>> weird results. >>>> >>>> Will it help if I pass a long sinusoid of the passband frequency >> before >>>> passing my signal? Is this a good way of preventing the transient >> response >>>> from affecting the filtering? >>>> >>>> Thanks a million! >>>> >>>> --- Par. >>> >>>No. Superposition applies. So, there will be the same transient due to >> any >>>new signal that is applied to the input. If the proposed signal is the >> same >>>frequency as the desired to-be-detected signal then you would have to >> figure >>>out some way to separate them. The transient would affect the detection >> / >>>separation process. So, it's not going to help and will probably >> hinder. >>> >>>Fred >>> >>> >>> >> >> Fred, >> >> Yeah ... I get it. So, do you know what is generally done to settle an IIR >> filter? >> >> This might be a common requirement while using IIR filters, and so, are >> there any popular ways of settling an IIR filter before passing the >> desired signal through it? >> > >"Settling" the filter applies to all individual inputs. Thus my remark >about *superposition*. >It cannot be done. There is nothing that can "settle" a filter for an input >that has not yet occurred. If there were, that would be predicting the >future.
Note that the OP specified a number of samples with no relationship to time. For all we know the samples are in space rather than in time, or were taken last year, with no future time involved anywhere. One possible method of reducing startup transients is to apply an IIR filter both backwards and forwards over a buffer much longer than the actual data for multiple passes. Enough smearing and the output will look completely settled within the window of interest. One will need enough numerical precision and perhaps a very low Q to not just end up with only the ringing of the filter itself though. Not sure if this is useful, but I think I've heard of people who do things like this to process recorded audio samples (forget why... notching out some background intermittant hum maybe?). IMHO. YMMV. -- Ron Nicholson rhn AT nicholson DOT com http://www.nicholson.com/rhn/ #include <canonical.disclaimer> // only my own opinions, etc.
"Ronald H. Nicholson Jr." wrote:
> > Not sure if this is useful, but I think I've heard of people who do things > like this to process recorded audio samples (forget why... notching out > some background intermittant hum maybe?).
Bi-directional IIR filtering is often done to get a linear phase from an IIR filter. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "Having a firewall that allows NFS to the Internet is like having a seat belt that lets your head touch the dashboard." -- Marcus Ranum
Why not use an FFT?

Par wrote:

> Hello Guys! > > I have a brief signal, about 100 values, having unknown frequency > components including a single frequency of interest to me. I have designed > an IIR filter using MATLAB that will filter out the single frequency. > > However, since the signal is brief, I face the problem that the filter has > a non-zero transient response while handling most of my signal. This causes > weird results. > > Will it help if I pass a long sinusoid of the passband frequency before > passing my signal? Is this a good way of preventing the transient response > from affecting the filtering? > > Thanks a million! > > --- Par. > > > > This message was sent using the Comp.DSP web interface on > www.DSPRelated.com
-- Please change no_spam to a.lodwig when replying via email!