Biomedical Engineering Reference
In-Depth Information
for i ¼ 1:length(data) data{i}{4} ¼ double(data{i}{4}); end ;
datamag ¼ data; % create copy of data
f ¼ SR*(0:2500/2)/2500; % frequency data
for m ¼ 1:length(data)
kernel ¼ fft(datamag{m}{4}(7,:)) ;
kernel ¼ kernel/max(kernel) ;
datamag{1} ;
for (n ¼ 1:6)
z ¼ abs(fft(data{m}{4}(n,:)).*(1 - kernel)); % remove eog
z ¼ z (1:length(f)) ;
z ¼ bpf(59.5, 60.5, SR, z, 'f', 1); % apply bandstop
filter at 60Hz (see bpf.m)
datamag{m}{5}(n,:) ¼ abs(z); % power series for trial
end
end
clear avgdata ;
% average over all experiments
for m ¼ 1 : EXPERIMENTS
trials ¼ [];
for n ¼ 1:SESSIONS
trials ¼ [trials (m 1)* TRIALS þ (n 1) * EXPERIMENTS * TRIALS þ (1:TRIALS)] ;
end
avgdata{m} ¼ averagedata(datamag, trials);
%by subject
for i ¼ 1 : length(SUBJ)
subjdata{i,m} ¼ averagedata (datamag, intersect(trials, SUBJ{i})) ;
end
%by age
for i ¼ 1:3
if (i ¼¼ 1)
z ¼ [SUBJ{3} SUBJ{4} SUBJ{5} SUBJ{6} SUBJ{7}]; %age < 30
elseif (i ¼¼ 2)
z ¼ SUBJ{2}; % age 30-40
else
z ¼ SUBJ{1}; % age 40 - 50
end
agedata{i,m} ¼ processavg (averagedata (datamag, intersect (trials, z)), SR) ;
end
%by handedness
for i ¼ 1:2
if (i ¼¼ 1)
z ¼ SUBJ{1}; % LH
else
z ¼ setdiff(1:EXPERIMENTS*SESSIONS*TRIALS, SUBJ{1}); % RH, all not in LH
end
handdata{i,m} ¼ processavg(averagedata(datamag, intersect(trials, z)), SR) ;
end
% by gender
for i ¼ 1:2
if (i ¼¼ 1)
z ¼ SUBJ{5}; % female
else
z ¼ setdiff(1:EXPERIMENTS*SESSIONS*TRIALS, SUBJ{5}); % male (setdiff ¼¼> everyone
else)
end
Search WWH ::




Custom Search