%filters data and plots power spectrum for 64 electrode array
%requires raw data 

function [waveCorr, time] = PlotAutoCorr4(wave, lesst);
extra=[0];
rev=flipud(lesst);
time=cat(1,-rev,lesst,extra);
time=time';
%waveFilt = BudapestbandPass(wave,1000,5,200);
[waveCorr,lags] = xcov(wave(1:300,1:64),300,'coeff');
%[waveCorr,lags] = xcorr(waveFilt(200:700,2:65),200,'coeff');

%Lrotate=ones(8,8);
%for m=1:8
 %   for n=1:8
  %      Lrotate(m,n)=n*8-m+1;
  % end
  %end
%Lrotate=reshape(Lrotate,1,64);

%Rrotate=ones(8,8);
%for n=1:8
 %   for m=1:8
  %      Rrotate(m,n)=8*(8-m)+n;
  % end
  %end
%Rrotate=reshape(Rrotate,1,64);

%figure
%plot(time,waveCorr(:,64.*12+12)); axis([-0.1 0.1 -1 1]);
figure
for n=1:64
subplot(8,8,n); plot(time, waveCorr(:,64*(n-1)+n)); axis([-0.1 0.1 -1 1]); %axis off;
end
