Hello everyone!
I am trying to extract the power of certain frequency bands from my EDA signal. To this purpose, I computed Welch's power spectral density on the signal, and then I wanted to extract the power of the frequencies of interest by calculating the area under the curve between the intervals w = [0, 0.045], w = [0.045, 0.15], and w = [0.15, 0.25]. Does anyone know how I can extract the AUC just within those windows?
I tried to use trapz( ) on just some portions of the signal, but the results look too weird to be accurate. Here is what I did:
% Total signal
EDA_auc = trapz(EDA_pxx); % total power = 0.1063
% AUC for x = [0 0.045]
% cut the signal and do trapz()
y = EDA_pxx(EDA_pxx >= 0 & EDA_pxx <= 0.045);VLF_auc = trapz(y); % output = 0.1063
% AUC for x = [0.045 0.15]
y1 = EDA_pxx(EDA_pxx >= 0.045 & EDA_pxx <= 0.15);LF_auc = trapz(y1); % output = 0
The code here should give you a better understanding of the portions of area I would like to calculate:
% w is frequency and is plotted on the x-axis; EDA_pxx is the result of the Welch's PSD analysis and is plotted on
% the y-axis.
figure;subplot(2,1,1)plot(w, EDA_pxx)title("Welch's Power Spectral Density")xlabel('Normalised frequency')ylabel('Power')subplot(2,1,2)plot(w, EDA_pxx);title('Portions of interest')xlabel('Normalised frequency')ylabel('Power')hold onidx = w >= 0 & w <= 0.25;H = area(w(idx), EDA_pxx(idx));set(H(1),'FaceColor',[1 0.5 0]);xlim([0 0.4])xline(0.045, ':r')xline(0.15, ':r')hold off
I hope it's clear what I'm asking for.
Thank you very much in advance for any suggetsion!
Best Answer