I am working with EEG signal analysis. I have built the code to apply signal filters and apply pwelch. But I have not been able to apply a for cycle so that the process is repeated from one column to another generating the results I want per column (each column is a channel or electrode of the EEG).
data=xlsread('subjet');
F7=data(:,4);%columna 4 planilla.
Fs=127;%Hz hay 127 muestras por segundo
Ts=1/Fs;%Frecuencia de muestreo
plot(F7,'b');
F7filtered= getFilteredSignal( F7, 2, 50,4,Fs );
hold on;
plot(F7filtered,'r');
[Pxx_F7, w_R]=pwelch(F7filtered,128,[],256,Fs);
[rowBeta1,colBeta1]=find(w_R>=13,1,'first');
[rowBeta2,colBeta2]=find(w_R>30,1,'first');
[rowTheta1,colTheta1]=find(w_R>=3.5,1,'first');
[rowTheta2,colTheta2]=find(w_R>7.5,1,'first');
fig=figure('Visible','on');
plot(w_R(rowBeta1:rowBeta2),Pxx_F7(rowBeta1:rowBeta2));% Se grafica las frecuencias de la señal
xlabel('Frequency(Hz)');
ylabel('Spectral Potency');
legend('BETA');
title('Beta Wave');
fig2=figure('Visible','on');
plot(w_R(rowTheta1:rowTheta2),Pxx_F7(rowTheta1:rowTheta2));% Se grafica las frecuencias de la señal
xlabel('Frequency(Hz)');
ylabel('Spectral Potency');
legend('Theta');
title('Theta Wave');
fig3=figure('Visible','on');
plot(median(Pxx_F7(rowTheta1:rowTheta2))/median(Pxx_F7(rowBeta1:rowBeta2)), '.-'); %promedio de los espectros de frecuencia
xlabel('F7');
ylabel('Theta/Beta ratio');
legend('Adolfo');
title('Power Ratio Theta/Beta');