I want to calculate the frequency amplitude asymmetry between two signals, EEG signals in particular. As a result, I expect a value ranging from 0 to 1. I have some references regarding that, but it's not clear in my mind what I have to do in order to write a correct matlab code for it. "EEG amplitude asymmetry differences were computed as a ratio of differences in absolute power between two scalp locations or (A - B/A + B)* 200 where A and B are the absolute power recorded from two different electrode locations". This is an equation I found from a paper, and this is my attempt writing a script on it
N = 2^12; % FFT points
x = EEG.data(2,1:N); %% reading data from 1st channel
xn = x*10^-6; % multiply with 10^-6 because values are in microvolts
y = EEG.data(3,1:N); % reading data from 2nd channel
yn = y*10^-6; % multiply with 10^-6 because values are in microvolts
Fs=250; % sampling rate
Ak1 = abs(fft(xn))/length(x); % do FFT for 1st channel(amplitude specturm)
Ak2 = abs(fft(yn))/length(y); % do FFT for 2nd channel(amplitude specturm)
Ak1(2:N)=2*Ak1(2:N); % convert to one side spectrum
Ak2(2:N)=2*Ak2(2:N); % convert to one side spectrum
Pk1=Ak1.*Ak1; % compute power spectrum 1st channel
Pk1=Pk1(1:N/2); % use N/2 pts in spectrum 1st channel
Pk2=Ak2.*Ak2; % compute power spectrum 2nd channel
Pk2=Pk2(1:N/2); % use N/2 pts in spectrum 2nd channel
freqbin = round(15 / (Fs/N)); % random frequency bin
AA=(Pk1-Pk2)/(Pk1+Pk2); % amplitude asymmetry according to the equation above
Note*If I try to multiply the AA with 200 that gives me a value that is not between 0 and 1.
Thanks in advance for any help
AA=(Pk1-Pk2)/(Pk1+Pk2)
and knowing thatPk1
andPk2
are positive numbers, please explain why you expect the result to ranging from 0 to 1? IfPk2
is bigger thanPk1
the result can be negative. Nevertheless, I am not sure what exactly your question is? Are you asking whether your implementation is correct or why your results are not in the expected range? $\endgroup$ – Irreducible Jan 14 '20 at 7:08