Arduino processing 13 bit barker code experiment

playing with barker code

generating 4 khz 13 bit barker code using Arduino and ad9833 function generator to modulated the barker code with 8 khz sine wave carrier and processing sketch analysis the results

I sense similarities with the fast Walsh Hadamard transform which also uses patterns of +1,-1 parameters. I will take a look at the dot product geometric meaning of Barker codes.
https://en.wikipedia.org/wiki/Barker_code
https://sites.google.com/view/algorithmshortcuts/2-point-wht

part of my code


int[] barkerCode = {1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1};
,
,
,
,
// Function to compute the autocorrelation of a signal
float[] computeAutocorrelation(float[] signal) {
  int n = signal.length;
  float[] autocorr = new float[n];

  for (int lag = 0; lag < n; lag++) {
    float sum = 0;
    for (int i = 0; i < n - lag; i++) {
      sum += signal[i] * signal[i + lag];
    }


barker code explain