```Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Sinusoidal phase difference issue.
Date: Mon, 20 Jun 2011 18:58:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 11
Message-ID: <ito57s\$579\$1@newscl01ah.mathworks.com>
References: <itnrb0\$2ku\$1@newscl01ah.mathworks.com> <itntrm\$a1j\$1@newscl01ah.mathworks.com> <ito1pa\$mpo\$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1308596284 5353 172.30.248.45 (20 Jun 2011 18:58:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 20 Jun 2011 18:58:04 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:732846

"zoul " <joelsubash@gmail.com> wrote in message <ito1pa\$mpo\$1@newscl01ah.mathworks.com>...
> I fail to understand (mostly due to ignorance) how you have made the estimate over an infinite number of cycles, although the time lag of -0.15 is correct when f equals 2(using the given code). Could you please explain in more detail the issue pointed out when f increases.Also do you reckon using correlation is the best way to estimate time lag(phase difference) if large number of cycles are used??
> cheers
- - - - - - - - -
You are dealing with a periodic function in the sine function and therefore such matters as time lag are inherently indeterminate when they involve time periods of greater than half that period.  As you increase the frequency of the sine wave you decrease the value at which that time lag computation becomes indeterminate.  Check out:

http://en.wikipedia.org/wiki/Nyquist&#8211;Shannon_sampling_theorem

My remark about the total number of cycles involved is based on the idea that if only a few cycles are included in the correlation computation, then other periodicities are present in your signal and can skew your results.  You need many cycles to minimize the effect of such aperiodicities (if that is a valid word.)

Roger Stafford
```