Autocorrelation
ptolemy.domains.sdf.lib.Autocorrelation

This actor calculates the autocorrelation of a sequence of input tokens. It is polymorphic, supporting any input data type that supports multiplication, addition, and division by an integer. However, since integer division will lose the fractional portion of the result, type resolution will resolve the input type to double or double matrix if the input port is connected to an integer or integer matrix source, respectively.

Both biased and unbiased autocorrelation estimates are supported. If the parameter biased is true, then the autocorrelation estimate is

 N-1-k
 1  ---
 r(k) = -  \    x*(n)x(n+k)
 N  /
 ---
 n = 0
 
for k = 0, ... , p, where N is the number of inputs to average (numberOfInputs), p is the number of lags to estimate (numberOfLags), and x* is the conjugate of the input (if it is complex). This estimate is biased because the outermost lags have fewer than N terms in the summation, and yet the summation is still normalized by N.

If the parameter biased is false (the default), then the estimate is

 N-1-k
 1   ---
 r(k) = ---  \    x*(n)x(n+k)
 N-k  /
 ---
 n = 0
 
In this case, the estimate is unbiased. However, note that the unbiased estimate does not guarantee a positive definite sequence, so a power spectral estimate based on this autocorrelation estimate may have negative components.

The output will be an array of tokens whose type is at least that of the input. If the parameter symmetricOutput is true, then the output will be symmetric and have length equal to twice the number of lags requested plus one. Otherwise, the output will have length equal to twice the number of lags requested, which will be almost symmetric (insert the last sample into the first position to get the symmetric output that you would get with the symmetricOutput being true).

Author(s): Edward A. Lee and Yuhong Xiong
Version:$Id: Autocorrelation.java,v 1.40 2006/05/08 04:48:47 neuendor Exp $
Pt.Proposed Rating:Green (eal)
Pt.Accepted Rating:Yellow (neuendor)




biased
If true, the estimate will be biased. This is a boolean with default value false.

numberOfInputs
Number of input samples to average. This is an integer with default value 256.

numberOfLags
Number of autocorrelation lags to output. This is an integer with default value 64.

symmetricOutput
If true, then the output from each firing will have 2*numberOfLags + 1 samples (an odd number) whose values are symmetric about the midpoint. If false, then the output from each firing will have 2*numberOfLags samples (an even number) by omitting one of the endpoints (the last one). This is a boolean with default value false.