-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotSummary.m
More file actions
70 lines (64 loc) · 2.55 KB
/
plotSummary.m
File metadata and controls
70 lines (64 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
% This script plots summary plots at a channel
dataStim_chan = squeeze(dataStim(:, :, chan));
dataRest_chan = squeeze(dataRest(:, :, chan));
pxxStim_chan = squeeze(pxxStim(:, :, chan));
pxxRest_chan = squeeze(pxxRest(:, :, chan));
dataBroadStim_chan = squeeze(dataBand.broad.trialsStim(:, :, chan));
dataBroadRest_chan = squeeze(dataBand.broad.trialsRest(:, :, chan));
dataAlphaStim_chan = squeeze(dataBand.alpha.trialsStim(:, :, chan));
dataAlphaRest_chan = squeeze(dataBand.alpha.trialsRest(:, :, chan));
dataBroadStim_chan = movmean(dataBroadStim_chan, 0.05*srate, 2);
dataBroadRest_chan = movmean(dataBroadRest_chan, 0.05*srate, 2);
figure('Position', [600, 300, 600, 1200]);
switch ref
case 'car'
sgtitle(sprintf('Ch%d - %s', chan, chNames{chan}));
case 'bipolar'
sgtitle(sprintf('Ch%d - %s', chan, bipolarChans{chan}));
end
subplot(4, 1, 1); % plot time series
hold on
plotCurvConf(t_trial, dataRest_chan, 'k', 0.3);
plotCurvConf(t_trial, dataStim_chan, 'r', 0.3);
plot(t_trial, mean(dataRest_chan), 'k', 'LineWidth', 1);
plot(t_trial, mean(dataStim_chan), 'r', 'LineWidth', 1);
xline(0, 'Color', [0.3 0.3 0.3]);
hold off
ylabel('V (uV)');
title('time series');
xlim([-0.2, 0.8]);
subplot(4, 1, 2); % time-varying broadband, plot 12-point (10 ms) moving average
hold on
plotCurvConf(t_trial, dataBroadRest_chan, 'k', 0.3);
plotCurvConf(t_trial, dataBroadStim_chan, 'r', 0.3);
plot(t_trial, mean(dataBroadRest_chan), 'k', 'LineWidth', 1);
plot(t_trial, mean(dataBroadStim_chan), 'r', 'LineWidth', 1);
xline(0, 'Color', [0.3 0.3 0.3]);
hold off
ylabel('Log_{10} Power');
title('Broadband (70 - 170 Hz)');
xlim([-0.2, 0.8]);
% Apply 10s moving mean to alpha
dataAlphaRest_chan = movmean(dataAlphaRest_chan, round(0.01*srate), 2);
dataAlphaStim_chan = movmean(dataAlphaStim_chan, round(0.01*srate), 2);
subplot(4, 1, 3); % time-varying alpha, plot 60-point (50 ms) moving average
hold on
plotCurvConf(t_trial, dataAlphaRest_chan, 'k', 0.3);
plotCurvConf(t_trial, dataAlphaStim_chan, 'r', 0.3);
plot(t_trial, mean(dataAlphaRest_chan), 'k', 'LineWidth', 1);
plot(t_trial, mean(dataAlphaStim_chan), 'r', 'LineWidth', 1);
xline(0, 'Color', [0.3 0.3 0.3]);
hold off
xlabel('time (s)');
ylabel('Log_{10} Power');
title('Alpha (8 - 12 Hz)');
xlim([-0.2, 0.8]);
subplot(4, 1, 4); hold on % PSD
plotCurvConf(f, log10(pxxRest_chan), 'k', 0.3);
plotCurvConf(f, log10(pxxStim_chan), 'r', 0.3);
plot(f, mean(log10(pxxRest_chan)), 'k', 'LineWidth', 1.5);
plot(f, mean(log10(pxxStim_chan)), 'r', 'LineWidth', 1.5);
xlabel('Frequency (Hz)'); ylabel('PSD');
xlim([0, 200]);
title('PSD');
hold off