# Phase Congruential White Noise Generator
## 2 White Noise Autocorrelation Matrix
namespace P070202  { class cP070202  { static void Main(string[] args)  { const int NS = 33; // signal counter quantity }  Console.WriteLine(\"NS = {0}\", NS);  Random rdm = new Random(0); // integer random generator  double max = (double)0x7 FFFF;  double[] s0 = new double[NS]; // initial signal s0  for (int i = 0; i < NS; i++)  s0[i] = 4.0 * (double)rdm.Next) / max - 0.5); // matrix z for vectors  double[,] z = new double[NS, NS];  MatrixZ(z, s0, rdm, NS, max); // matrix v for vectors  double[,] v = new double[NS, NS];  MatrixV(v, z, NS); // autocorrelation matrix A double[,] a new double[NS, NS];  MatrixA(a, v, NS);  Console.WriteLine(\"A = \");  for (int i = 0; i < NS; i++)  { Console.Write(\"(0,8:F3)\", a[i, 0]);  Console.Write(\"(0,8:F3)\", a[i, 1]);  Console.Write(\"(0,8:F3)\", a[i, 2]);  Console.Write(\" - - - \");  Console.Write(\"(0,8:F3)\", a[i, NS - 2]);  Console.WriteLine(\"(0,8:F3)\", a[i, NS - 1]);  }  double[,] r = new double[NS, NS];  MatrixR(r, a, v, NS);  Console.WriteLine(\"R = \");  for (int i = 0; i < NS; i++)  { Console.Write(\"(0,8:F3)\", r[i, 0]);  Console.Write(\"(0,8:F3)\", r[i, 1]);  Console.Write(\"(0,8:F3)\", r[i, 2]);  Console.Write(\" - - -\");  Console.Write(\"(0,8:F3)\", r[i, NS - 2]);  Console.WriteLine(\"(0,8:F3)\", r[i, NS - 1]);  }  Console.ReadKey(); // result viewing  } //- static void MatrixR(double[,] r, double[,] a,  double[,] v, int NS)  { for (int i = 0; i < NS; i++)  for (int j = i; j < NS; j++)  { double iE2 = 0.0;  double jE2 = 0.0;  for (int m = 0; m < NS; m++)  { iE2 += v[i, m] * v[i, m];  jE2 += v[j, m] * v[j, m];r[i,j] = a[i,j] / Math.Sqrt(iE2 * jE2); r[j,i] = r[i,j]; } //-------------------------------- static void MatrixA(double[,] a, double[,] d, int NS) { for (int i = 0; i < NS; i++)  for (int i = i; j < NS; j++) { a[i,j] = 0.0;  for (int m = 0; m < NS; m++)  a[i,j] += d[i, m] * d[j, m];  a[j, i] = a[i, j]; } //-------------------------------- Function \(MatrixV\) from previous program \(P070201\) //-------------------------------- Function \(MatrixZ\) from previous program \(P070101\) //-------------------------------- }
```
After executing the program \(P070202\), the autocorrelation matrix \(A\) and the matrix of autocorrelation coefficients \(R\) appear on the monitor. The omitted values are changed by a dash. ```
NS = 33 A = 44.628 -4.879 -1.959 -5.740 -2.823 -4.879 46.943 -5.032 -6.393 2.941 -1.959 -5.032 46.121 -3.466 -6.470 -12.693 -1.203 -5.562 -9.785 -4.531 2.965 -16.188 -1.669 -5.198 -5.778 ------ 5.740 -6.393 -3.466 -39.945 0.869 -2.823 2.941 -6.470 -0.869 43.248 R = 1.000 -0.107 -0.043 -0.136 -0.064 -0.107 1.000 -0.108 -0.148 0.065 -0.043 -0.108 1.000 -0.081 -0.145 -0.280 -0.026 -0.121 -0.228 -0.101 0.062 -0.332 -0.034 -0.115 -0.123 ------ 0.136 -0.148 -0.081 -1.000 0.021 -0.064 0.065 -0.145 -0.021 1.000
```

In the analysis of signals a set of consecutive \(n\) countings makes it possible to form or detect discrete spectra of multiple internal Fourier frequencies. By the nature of the frequency distribution there are white noise signals with a uniform distribution of intensities, a normal Gaussian distribution, and many others. This article focuses on white noise with a uniform intensity distribution at Fourier frequencies, i.e., all frequencies are of the same intensity. In a random process, the signals of uniform white noise are characterized by the following properties:Uniform distribution of intensities at all internal frequencies of the signal;
2. Zero value of mathematical expectation (the first moment) of the values of countings in the signal;
3. Autocorrelation matrix has a diagonal form with equal meanings of dispersion (the second moment) along the main diagonal and zero values for all other elements. From this designation it follows that white noise signals should be orthogonal in an environment of independent countings with equal amplitudes at all internal frequencies. Therefore, property (1) forces us to consider the set of exactly \(n\) countings in the signals \(S\) with the further use of Fourier frequency analysis.