DSPRelated.com
Forums

Filters and how to calculate Delay

Started by adap...@yahoo.co.jp July 31, 2009
Greetings everyone in the group.
This is my first message. I am not a DSP engineer but a programmer with a very limited knowledge of filters. I am writing in the hope that someone can help me with his/her expertise in the following problem:

I have a butterworth filter implemented in software.(C++) So far it works exactly the same as the functions: butter() and filter() in Matlab. Therefore when I use butter with an order and a cuttoff freq it builds a filter, and then I can use it with a signal with noise and obtain and noise-free signal.

My question is:
I would like to know of a method to calculate the "delay" between the original signal and the filtered one. As far as I understand this must be a value in seconds.

So far I have found the function groupdelay() but I dont think this is what I am looking for. It gives me a matrix when I am only searching for a single value(the delay for a particular filter designed with a particular cuttoff freq is only a number)

Can anyone point me where to look?

I will be very grateful for your help.

Kansai Robot.
With sin wave, you should get multiple peaks, but white noise can get better
results, just one peak indicating your delay.
And the delay of a filter is invariable to signal, so you can get test your
filter by white noise.

2009/8/2

> Hello Wayne
>
> Thank you very much for the reply.
> I actually tried something with correlation as in:
>
> fs0
> fo 0
> t=0:1/fs:1-1/fs;
> x=sin(2*pi*fo*t).*exp(-20*t);
> y=[zeros(1,500) x(1:length(x)-500)];
> xc=xcorr(x,y);
> [a,delay]=max(xc)
> subplot(311),plot(x)
> subplot(312),plot(y)
> subplot(313),plot(xc(1:1000))
> and it worked, it gave me the delay but it does not work in all curves such
> as:
>
> x=sin(2*pi*fo*t);
> y=sin(2*pi*fo*(t-0.01)); %time delay 0.01s
> so it got me really confused.
> Could you give me your thoughts on this?
>
> Thanks a lot in advance
>
> Kansai
>
> P.S. I dont know if I am in the list. I got a reject message, so I am not
> really sure.
>
> *Wayne * wrote:
>
> Hi kansai,
> You can calc the cross correlation between the filtered and the
> original one. It may give the delay in unit of sample.
> Just for reference
> BR
> Wayne
>
> On 7/31/09, a...@yahoo.co.jp wrote:
> > Greetings everyone in the group.
> > This is my first message. I am not a DSP engineer but a programmer with a
> > very limited knowledge of filters. I am writing in the hope that someone
> can
> > help me with his/her expertise in the following problem:
> >
> > I have a butterworth filter implemented in software.(C++) So far it works
> > exactly the same as the functions: butter() and filter() in Matlab.
> > Therefore when I use butter with an order and a cuttoff freq it builds a
> > filter, and then I can use it with a signal with noise and obtain and
> > noise-free signal.
> >
> > My question is:
> > I would like to know of a method to calculate the "delay" between the
> > original signal and the filtered one. As far as I understand this must be
> a
> > value in seconds.
> >
> > So far I have found the function groupdelay() but I dont think this is
> what
> > I am looking for. It gives me a matrix when I am only searching for a
> single
> > value(the delay for a particular filter designed with a particular
> cuttoff
> > freq is only a number)
> >
> > Can anyone point me where to look?
> >
> > I will be very grateful for your help.
> >
> > Kansai Robot.
> >