See the C–program "acf1" for calculating the discrete ACF values φx(k) with index k=0, ... , l. The following should be noted about this:
- The long–value passed to the program is l=10. The ACF values φx(0), ... , φx(10) are returned to the calling program with the float field ACF[ ]. In lines 7 and 8 of the program given on the right, this field is pre-populated with zeros.
- The random variables xν to be analyzed are generated with the float function x( ), see line 4. This function is called a total of N+l+1=10011 times xν (lines 9 and 18).
- In contrast to the algorithm given in the Theory section directly implemented in the program "acf2" of Task 4.11Z, one needs here an auxiliary field H[ ] with only l+1=11 memory elements.
- Before starting the actual calculation algorithm (lines 11 to 21), the eleven memory cells of H[ ] contain the random values x1, ... , x11. The outer loop with the index z (marked in red) is run N times.
- In the inner loop (marked white) with the index k=0, ... , l all memory cells of the field ACF[k] are increased by the contribution xν⋅xν+k.
- Finally, in lines 22 and 23, all ACF values are divided by the number N of analyzed data.
Hint:
- This exercise belongs to the chapter Auto-Correlation Function.
- Reference is made in particular to the page Numerical ACF determination.
Questions
Solution
(1) With z=0 and k=6 results according to the program: i=0_ and j=6_.
- The corresponding memory contents are H[0]=x1 and H[6]=x7.
(2) In the field H[0] the random variable x12 is now entered:
- memory cell i=0_,sequence index ν=12_.
(3) The graph shows the allocation of the auxiliary field with the random values xν.
- In each case, the memory cell H[i] is highlighted in green. The new random variable is entered into this memory location at the end of each loop (line 18).
- For z=83 and K=6 this results in
- \underline{i= 83 \hspace{-0.2cm}\mod \hspace{-0.15cm} \ 11 = 6},\hspace{1cm} \underline{j= (i+k)\hspace{-0.2cm}\mod \hspace{-0.15cm} \ 11 = 1}.
- Loop pass z= 83: In memory cell {\rm H}\big[\hspace{0.03cm} 6 \hspace{0.03cm}\big] is the random variable x_{84} and in the memory cell {\rm H}\big[\hspace{0.03cm} 1 \hspace{0.03cm}\big] is the random variable x_{90}.
- At the end of loop pass z= 83 in {\rm H}\big[\hspace{0.03cm} 6 \hspace{0.03cm}\big]: The content x_{84} is replaced by x_{95} .