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

function [f] = PlotPowerSpec6( wave );
%waveFilt=wave;
waveFilt = BudapestbandPass(wave(:,1:64),1000,5,100,1000);
%wavefft = fft(waveFilt);
wavemag = abs(fft(waveFilt,2048));
%wavemag(1,:)=0;
f = (1000*(0:1023)/2048);

%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(f, wavemag(1:1024,36)); axis([0 100 0 50]); axis off; %xlabel ('Frequency (Hz)'); ylabel ('Magnitude');

%figure
%for n=1:64
%subplot(8,8,n); plot(f, wavemag(1:1024,n)); axis([0 50 0 5]); axis off;
%end

%for n=1:64
%[C(n),I(n)]=max(wavemag(:,n));
%end
%amp=reshape(C,8,8)'
%freq=reshape(I,8,8)'