title: Using vectorization to compute moving average in Matlab
body: <p>I wrote a script to compute simple moving average of a vector using for-loop:</p>
  
  <pre><code>X=rand(1000,1); 
  Y=nan(size(A));
  for i=100:length(A);
      Y(i)=mean(X(i-99:i));
  end
  </code></pre>
  
  <p>Could I use any vectorization method to avoid the loop? Thanks.</p>