Ex 4: oscillatory responses

The data required in the assignment can be downloaded from http://neuro.hut.fi/~jjkujala/FBI_DATA_osc.zip. 

Matlab code designed to help in the assignment is given underneath in another tar-file (http://neuro.hut.fi/~jjkujala/FBI_code_osc.zip).

The assignment consists of two parts, and of writing a report describing and showing the main findings.

1. Spontaneous oscillatory activity

Analyze how spontaneous (continuous) oscillatory activity is modulated when the subject opens his/her eyes. Identify the peak frequency of the modulation, identify which of the two data-sets (data1, data2) represents eyes-closed condition, and show the effects on the MEG sensors. 

The data and related variables are contained in the file P1_spontaneous_data.mat

  • chanNames=names of MEG sensors
  • sff=sampling frequency) . 

Visualization of the spectra across sensors can be conducted with the function: 

plotSpectra (e.g., plotSpectra(f,spectra,spectra2,'coils','grad2'), 

where f contains the frequency bins where the spectra have been estimated and spectra1/spectra2 the estimated spectra; selection of visualized frequencies and the scaling of the visualization is controlled via options 'xlimits' and 'ylimits', e.g., plotSpectra(f,spectra,spectra2,'coils','grad2','xlimits',[2 25],'Ylimits',[-5e-10 3e-9]) )


  • To estimate the spectra, use function pwelch. Compute the spectrum for one channel at a time (in a loop).
  • Select a reasonable frequency resolution; around half-a-hertz will suffice; see matlab help for pwelch (nfft).
  • When visualizing, concentrate on frequencies below 30Hz so that the possible high-frequency noise does not hamper the detection of the sought power peak for alpha frequency (about 10Hz).

2. Induced responses, time-frequency representation

Analyze the event-related modulation of rhythmic activity via time-frequency representations (TFR) during an attentive visual task. Identify the frequency range where the main modulation occurs and show the effects on the MEG sensors. 

The data and related variables are contained in the file P1_event-related_data.mat; 

the file contains a single structure (epochs) with several fields (

  • chan_names= names of recorded channels, 306 first contain the MEG data; 
  • peri_int=time-interval of the epochs/trials; 
  • Fs=sampling frequency; 
  • zero_sample=sample number at time 0; 
  • ns_pre=number of samples before stimulus presentation; 
  • ns_post=number of samples after stimulus presentation; 
  • ns_ep=length of epochs; data=cell array with the recorded data for all 120 epochs/trials). 

TFRs per trial and channel can be computed with the function energyvec (e.g., TFR=energyvec(f, time_series, Fs), 

where f is a frequency of interest, time_series the MEG data for a single channel, and Fs the sampling frequency). 

Visualization of the TFRs across sensors can be conducted with the function 

plotTFR (e.g., plotTFR(freqVec,timeVec,TFRS,'layout','NM306planar.lay','labels','on','baseline',[-0.3 0]);, 

where time/freqVec are vectors containing the time instances/frequencies where the TFRs have been computed). 

Scaling of the visualization is controlled via options 'xlimits', 'ylimits and 'zlimits' (e.g., plotTFR(freqVec,timeVec,TFRs,'layout','NM306planar.lay','labels','on','baseline',[-0.3 0],'xlimits',[-0.1 1],'ylimits',[3 20],'zlimits',[-1e-23 1e-23]); 

The baseline-subtraction can be performed also outside the visualization with the function TFRbaseline (TFRs=TFRbaseline(timeVec,freqVec,TFRs,[-0.3 0]); )


  • TFRs need to be computed first separately for each frequency, channel and epoch with the function energyvec
  • it is best to focus on reasonable frequency range and resolution, e.g., freqVec=[3:30];
  • to see when and at what frequency-range the bright spot in some of the channels really is, use function imagesc to visualize a single channel. In this you will need the provided TFRbaseline-function since imagesc does not perform a baseline correction (in plotTFR the baseline correction is built-in)