Commit 0a3bbb01 authored by 13035516's avatar 13035516
Browse files

averaging per signal rather than from the mean signal

parent d6b8e575
No preview for this file type
No preview for this file type
......@@ -56,12 +56,28 @@ meps.rec_MEP = rec_MEP;
%below calculations are from data at 0-30msec after stimulation pulse onset
%average peak-to-peak responses
er = OFF+1:MEP_WINDOW;
lr = MEP_WINDOW + 1 : POST_WINDOW;
for j = 1 : trials
trace = squeeze(out_MEPs(:,j,:));
er_trace = trace(er,:);
lr_trace = trace(lr,:);
[~ , er_lat(j,:)] = max(abs(er_trace));
[~ , lr_temp] = max(abs(lr_trace));
lr_lat(j,:) = (lr_temp + lr(1));
er_pk2pk(j,:) = max(er_trace) - min(er_trace);
lr_pk2pk(j,:) = max(lr_trace) - min(lr_trace);
end
er_lat = er_lat./10;
lr_lat = lr_lat./10;
early_pk2pk = max(mean_MEP(OFF+1:MEP_WINDOW, :)) - ...
min(mean_MEP(OFF+1:MEP_WINDOW,:));
late_pk2pk = max(mean_MEP(MEP_WINDOW+1:POST_WINDOW,:)) - ...
min(mean_MEP(MEP_WINDOW+1:POST_WINDOW,:));
pk2pk.early_pk2pk = early_pk2pk;
pk2pk.late_pk2pk = late_pk2pk;
pk2pk.early_pk2pk_vals = er_pk2pk;
pk2pk.late_pk2pk_vals = lr_pk2pk;
pk2pk.early_pk2pk = mean(er_pk2pk);
pk2pk.late_pk2pk = mean(lr_pk2pk);
% latency calculation
for c = 1 : nelec_ch
[Max_early(c) Imax_early(c)] = max(abs(mean_MEP(OFF+1:MEP_WINDOW,c)));
......
......@@ -59,9 +59,9 @@ for r = 1 : length(responses)
end
N = size(mep_arr_temp.out_MEPs,2);
amp_mu = mean(amp_arr_temp);
lat_mu = mean(lat_arr_temp);
auc_mu = mean(auc_arr_temp);
amp_mu = amp_arr_temp;
lat_mu = lat_arr_temp;
auc_mu = auc_arr_temp;
fprintf('%s: %s : %s : %d\n', response, treatment, week, N);
amp_sd = std(amp_arr_temp)/sqrt(N);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment