DSPRelated.com
Forums

Cross correlation and resolution

Started by JS March 16, 2009
Hi NG,

I am not sure if I am violating some DSP rule here.. I should know
this, but:

I have a time series of 49 samples, which is 49 days with 1 sample pr.
day. I have another 49 sample time series, also with 1 sample pr. day.
I would like to cross-correlate these two series to investigate a
possible lag, but preferably with a sub-daily resolution. So I
resample both time series (simple interpolation) to get e.g. 400
points instead of 49. I then get the best correlation with a lag of 9
samples, which corresponds to a little more than a day. But am I
fooling myself here - is it all all possible to match the two signals
on a sub-daily resolution? The 9 samples delay is very close to 1 day.
Is 1 day then actually the correct result?

Thanks!

best,

JS
JS <Joe778899@gmail.com> wrote:
 
> I am not sure if I am violating some DSP rule here.. > I should know this, but:
> I have a time series of 49 samples, which is 49 days with 1 sample pr. > day. I have another 49 sample time series, also with 1 sample pr. day. > I would like to cross-correlate these two series to investigate a > possible lag, but preferably with a sub-daily resolution. So I > resample both time series (simple interpolation) to get e.g. 400 > points instead of 49.
How did you do the resampling? I don't believe that simple interpolation is good enough to do what you are asking. Well, first it is very important that the signal be appropriately band limited before sampling. Often signals aren't quite band limited but close enough that it doesn't bother us too much. For audio signals, it is much more of a problem than video signals, for example.
> I then get the best correlation with a lag of 9 > samples, which corresponds to a little more than a day. But am I > fooling myself here - is it all all possible to match the two signals > on a sub-daily resolution? The 9 samples delay is very close to 1 day. > Is 1 day then actually the correct result?
Generate by hand two signals with an 8.5 sample delay. Apply your algorithm to those signals and see what result you get. Then test again after adding some noise to the signals. -- glen
On 16 Mar, 18:43, JS <Joe778...@gmail.com> wrote:
> Hi NG, > > I am not sure if I am violating some DSP rule here.. I should know > this, but: > > I have a time series of 49 samples, which is 49 days with 1 sample pr. > day. I have another 49 sample time series, also with 1 sample pr. day. > I would like to cross-correlate these two series to investigate a > possible lag, but preferably with a sub-daily resolution.
One way to do this, is to compute the cross spectrum of the two series and investigate the phase spectrum. If there is a lag, the unwrapped phase will show a linear trend which is proportional to the delay. Check out "Random Data" by Bendat and Piersol for details. Rune
On Mar 16, 5:11&#4294967295;pm, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 16 Mar, 18:43, JS <Joe778...@gmail.com> wrote: > > > Hi NG, > > > I am not sure if I am violating some DSP rule here.. I should know > > this, but: > > > I have a time series of 49 samples, which is 49 days with 1 sample pr. > > day. I have another 49 sample time series, also with 1 sample pr. day. > > I would like to cross-correlate these two series to investigate a > > possible lag, but preferably with a sub-daily resolution. > > One way to do this, is to compute the cross spectrum of the > two series and investigate the phase spectrum. If there is > a lag, the unwrapped phase will show a linear trend which > is proportional to the delay. Check out "Random Data" by > Bendat and Piersol for details. > > Rune
Hi both of you, Thanks for your replies. I will try and do as you suggest and see if I learn some more. I'll write if I encounter problems (likely..) Thanks again! best JS
On Mar 16, 5:37&#4294967295;pm, JS <Joe778...@gmail.com> wrote:
> On Mar 16, 5:11&#4294967295;pm, Rune Allnor <all...@tele.ntnu.no> wrote: > > > > > On 16 Mar, 18:43, JS <Joe778...@gmail.com> wrote: > > > > Hi NG, > > > > I am not sure if I am violating some DSP rule here.. I should know > > > this, but: > > > > I have a time series of 49 samples, which is 49 days with 1 sample pr. > > > day. I have another 49 sample time series, also with 1 sample pr. day. > > > I would like to cross-correlate these two series to investigate a > > > possible lag, but preferably with a sub-daily resolution. > > > One way to do this, is to compute the cross spectrum of the > > two series and investigate the phase spectrum. If there is > > a lag, the unwrapped phase will show a linear trend which > > is proportional to the delay. Check out "Random Data" by > > Bendat and Piersol for details. > > > Rune > > Hi both of you, > > Thanks for your replies. I will try and do as you suggest and see if I > learn some more. I'll write if I encounter problems (likely..) > > Thanks again! > > best > > JS
Another problem you may have is that you may not have enough data for your filter to reach steady state. If you data is 49 points long but your filter is 100 samples, then your filter may not be doing quite the interpolation that you are expecting. I believe Rune has discussed a previous technique of measuring the slope of the phase in the frequency domain - I don't know all the ins and outs of this. Rune might be able to provide additional information, or you can search through his posts on this newgroup. Cheers, David