1234567891011121314151617181920212223242526 |
- function [G,fAxis,showFreqs]=accuplot_mini(EEG, ch1, fs)
- % function for creating the Accusleep function
- % calls createSpectrogram.m, standardizeSR.m and processEMG.m (from Accusleep source code)
- EEGr=EEG';
- %% Accusleep
- epochLen=1;
- G = struct; % holds everything
- G.originalSR = fs; % EEG/EMG sampling rate
- G.SR = 128; % sampling rate used when calculating spectrogram and processed EMG
- G.epochLen = epochLen; % length of one epoch (spectrogram column) in seconds
- G.EEG=EEGr(ch1,:);
- % create spectrogram and process EMG at a standard SR (128)
- [spec, tAxis, fAxis] = createSpectrogram(standardizeSR(G.EEG, G.originalSR, G.SR), G.SR, G.epochLen);
- G.nbins = length(tAxis); % total number of time bins in the recording
- % get spectrogram and time axes
- showFreqs = find(fAxis <= 30); % only show frequencies under 30 Hz
- G.specTs = (1:G.nbins)*G.epochLen - G.epochLen/2; % spectrogram time axis, in seconds
- G.specTh = G.specTs./3600; % spectrogram time axis, in hours
- G.spectrogram = spec(:,showFreqs); % our EEG spectrogram
- end
|