Path: news.mathworks.com!not-for-mail
From: "Pekka " <pekka.nospam.kumpulainen@tut.please.fi>
Newsgroups: comp.soft-sys.matlab
Subject: Re: autocorrelation of sine function
Date: Fri, 14 Mar 2008 10:20:18 +0000 (UTC)
Organization: Tampere University of Technology
Lines: 33
Message-ID: <frdjh2$p73$1@fred.mathworks.com>
References: <frb892$pf5$1@fred.mathworks.com> <frbblq$hff$1@fred.mathworks.com> <frdd61$grl$1@fred.mathworks.com>
Reply-To: "Pekka " <pekka.nospam.kumpulainen@tut.please.fi>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1205490018 25827 172.30.248.35 (14 Mar 2008 10:20:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 14 Mar 2008 10:20:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 218565
Xref: news.mathworks.com comp.soft-sys.matlab:457209



"Nor Faizah " <a7khawarizmi@yahoo.com> wrote in message 
<frdd61$grl$1@fred.mathworks.com>...
> "Malcolm Lidierth" <ku.ca.lck@htreidil.mloclam> wrote in 
> message <frbblq$hff$1@fred.mathworks.com>...
> > try [c,lags]=xcorr(signal,'unbiased');
> > 
> > Coeff estimates are biased - for lags greater than zero 
> the 
> > number of valid data point pairs falls off to 1 at abs
> (lag)
> > ==data length.
> >
> 
> Thanks a lot. It gives the right plot. I don't understand 
> what do you mean by data point pairs falls off to 1 at abs
> (lag) ==data length.
 
Autocorrelation function r(lag) = E[x(n)*x(n+lag)]
If your data vector length is N, for lag==, you have the 
full N samples to estimate that expected value. 
For lag=1, (you "shift" one sample) you have only N-1 
samples left for estimation.
And actually when you reach lag=N-1, you will have only one 
sample left for the estimate. 
The larger the abs(lag), the smaller the number of samples 
in the estimate (mean of products) and therefore the 
estimate will have higher variance. Therefore the biased 
estimate is usually preferred, it attenuates the values for 
large lags, where there is higher variance. 
doc xcorr shows you the formulas plus link to one book for 
further reading
Didn't plan to write this long, sorry...