-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotWavSpec.m
More file actions
18 lines (15 loc) · 805 Bytes
/
plotWavSpec.m
File metadata and controls
18 lines (15 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
% This script gets the wavelet spectrogram of stim trials and normalizes them by the rest period before each stim trial
% in log10 space. Spectrogram is calculated as the mean of all normalized log-10 spectrograms
dataStim_chan = squeeze(dataStim(:, :, chan));
dataRest_chan = squeeze(dataRest(:, :, chan));
[S, fspec] = getWaveletSpectrogram(dataStim_chan', srate, [1, 200]);
S_norm = log10(S) - mean(log10(S(:, t_trial>restIntervalSpec(1) & t_trial<restIntervalSpec(2), :)), 2);
S_norm = mean(S_norm, 3); % average across trials
figure('Position', [300, 300, 600, 600]);
uimagesc(t_trial, fspec, S_norm, clim.spec); colormap(cm);
axis xy; % so that frequencies are in ascending order
xlim([-0.2, 1]);
xlabel('time (s)');
ylabel('F (Hz)');
colorbar('southoutside');
title(sprintf('channel %d', chan));