title: How to Create Autocorrelation Function without any buit-in functions like xcorr
body: <p>I want to auto-correlate a random noise vector with out any built-in MATLAB functions. </p>
  
  <p>My auto correlation equation that is given is: </p>
  
  <pre><code>Rxx[L] = ∑ from n = 1 to N-1 [x(n)*x(n+L)]
  
  L = [0:200]
  </code></pre>
  
  <p>I have written the code below but the <code>plot</code> <code>Rxx</code> vs <code>L</code> <code>plot</code> is not what I am expecting. 
  I am expecting my plot to start at some maximum at <code>L = 0</code> or <code>L = 1</code> since MATLAB starts its index at 1. Then exponentially decrease and saturates at a min of zero.</p>
  
  <hr>
  
  <pre><code>clc
  clear all
  
  randn('seed',2496132);
  n = randn(1,1024);
  
  upperbound = numel(n)-1;
  
  for L = 1:200
  
      for j = 1 : upperbound
  
              n1(j) = n(j)+L;
              Rxx(j) = (n(j)*n1(j));             
  
      end
  
      Rxx_sum(L) = sum(Rxx);
      Rxx = 0;
  
  end
  
  plot([1:200], Rxx_sum)
  </code></pre>