You are here: Frontpage : Introduction » Tutorials » Analysis of ongoing, evoked, and induced neuronal activity: Power spectra, wavelet analysis, and coherence

This shows you the differences between two versions of the page.

tutorial:power_spectra_wavelet_analysis_and_coherence [2011/11/27 19:32] Simon-Shlomo Poil |
tutorial:power_spectra_wavelet_analysis_and_coherence [2013/11/29 08:47] (current) Klaus Linkenkaer-Hansen |
||
---|---|---|---|

Line 26: | Line 26: | ||

</code> | </code> | ||

- | Go to the directory 'U' using 'cd'. | + | Go to the directory 'C' using 'cd'. If you do not have write access, try another drive, e.g., 'H'. |

<code> | <code> | ||

- | >> cd U | + | >> cd C:\ |

</code> | </code> | ||

Line 74: | Line 74: | ||

===== Classical analysis of ongoing activity: power spectra and coherence ===== | ===== Classical analysis of ongoing activity: power spectra and coherence ===== | ||

- | We now turn to the classical analysis of longer segments of ongoing activity, which to a large extend is the activity that we averaged away in the tutorial on averaged evoked responses, namely oscillations that are not phase-locked to the stimulus onset. | + | We now turn to the classical analysis of longer segments of ongoing activity, which to a large extent is the activity that we averaged away in the tutorial on averaged evoked responses, namely oscillations that are not phase-locked to the stimulus onset. |

Let’s quantify the frequency distribution of 'power' in the brain and noise signals using 'pwelch.m'. The 'pwelch' function is a high-level build-in MATLAB function based on the FFT. The input to the function is: | Let’s quantify the frequency distribution of 'power' in the brain and noise signals using 'pwelch.m'. The 'pwelch' function is a high-level build-in MATLAB function based on the FFT. The input to the function is: | ||

Line 136: | Line 136: | ||

Note how few key strokes are needed to perform new calculations and visualizations!\\ | Note how few key strokes are needed to perform new calculations and visualizations!\\ | ||

- | Do you see the problem with determining peak frequencies? | ||

+ | **Question: Do you see the problem with determining peak frequencies?** | ||

===== Wavelet Transform ===== | ===== Wavelet Transform ===== | ||

Line 154: | Line 154: | ||

==== Wavelet analysis of ongoing activity ==== | ==== Wavelet analysis of ongoing activity ==== | ||

- | Let's compute the time-frequency representation of the spontaneous data just used in the power spectrum analysis. The 20 min of data is too much for our computers to work with, because the wavelet transformed data take up a lot of memory (we make a copy of our data for each new frequency being analyzed!). Therefore, we focus on just 20 s of data: | + | Let's compute the time-frequency representation of the spontaneous data just used in the power spectrum analysis. The 20 min of data is too much for our computers to work with, because the wavelet transformed data take up a lot of memory (we make a copy of our data for each new frequency being analyzed). Therefore, we focus on just 20 s of data: |

<code> | <code> | ||

Line 171: | Line 171: | ||

</code> | </code> | ||

- | 'flipud' is just to flip the matrix upside down to plot the frequencies from low to high instead of high to low]. | + | 'flipud' is just to flip the matrix upside down to plot the frequencies from low to high instead of high to low. |

Note the burst-like appearance of the oscillations. Clearly, the wavelet gives a richer picture of the oscillatory dynamics than the power spectrum, which regards the 10 Hz oscillations as a constant sine wave… | Note the burst-like appearance of the oscillations. Clearly, the wavelet gives a richer picture of the oscillatory dynamics than the power spectrum, which regards the 10 Hz oscillations as a constant sine wave… | ||

Line 191: | Line 191: | ||

==== Wavelet analysis of stimulus evoked activity ==== | ==== Wavelet analysis of stimulus evoked activity ==== | ||

- | Time-frequency (TF) analysis is nowadays (since year 1999 or so) also widely used as a complement to classical averaged evoked response waveforms. Let's try this by applying the wavelet analysis to the evoked response that we analyzed earlier in the course. The following commands are copy-and-paste from previous tutorials: | + | Time-frequency (TF) analysis is nowadays (since year 1999 or so) also widely used as a complement to classical averaged evoked response waveforms. Let's try this by applying the wavelet analysis to a somatosensory evoked response (which you may just have computed in a previous tutorials). Compute and plot the evoked response using the following commands: |

<code> | <code> | ||

Line 197: | Line 197: | ||

>> Post = 1.5; | >> Post = 1.5; | ||

>> [M] = Single_trial_matrix(RSM, Trig, Fs, Pre, Post); | >> [M] = Single_trial_matrix(RSM, Trig, Fs, Pre, Post); | ||

- | >> Baseline_interval = 0.4 % I suggest a baseline interval of 400 ms. | + | >> Baseline_interval = 0.4; % I suggest a baseline interval of 400 ms. |

>> [M_baseline] = Single_trial_baseline(M, Fs, Pre, Baseline_interval); | >> [M_baseline] = Single_trial_baseline(M, Fs, Pre, Baseline_interval); | ||

>> t_ER = -Pre:1/Fs:Post-1/Fs; % Time vector for evoked response (ER). | >> t_ER = -Pre:1/Fs:Post-1/Fs; % Time vector for evoked response (ER). | ||

Line 244: | Line 244: | ||

<code> | <code> | ||

>> Frq_low = 3; | >> Frq_low = 3; | ||

- | >> Frq_high = 30 | + | >> Frq_high = 30; |

>> Frq_step = 1; | >> Frq_step = 1; | ||

>> [W,t,frq] = Wavelet_1ch(RSM, Fs, Frq_low, Frq_high, Frq_step); | >> [W,t,frq] = Wavelet_1ch(RSM, Fs, Frq_low, Frq_high, Frq_step); | ||

Line 262: | Line 262: | ||

</code> | </code> | ||

- | 'mean' takes the average along the 1st dimension of the 3D matrix 'WM', which essentially makes the 3D matrix 2D. MATLAB, however, only treats the matrix as 2D after the command 'squeeze'.] | + | 'mean' takes the average along the 1st dimension of the 3D matrix 'WM', which essentially makes the 3D matrix 2D. MATLAB, however, only treats the matrix as 2D after the command 'squeeze'. |

Let’s compare the result with the TF-plot of the averaged evoked response. | Let’s compare the result with the TF-plot of the averaged evoked response. | ||

Line 273: | Line 273: | ||

Note the values and sign on the color scale.\\ | Note the values and sign on the color scale.\\ | ||

+ | **Questions** | ||

- Can you identify similarities between the TF plot of the averaged evoked response and the average of the TF plots? | - Can you identify similarities between the TF plot of the averaged evoked response and the average of the TF plots? | ||

- What is the somewhat surprising conclusion from this plot? | - What is the somewhat surprising conclusion from this plot? | ||

- | The phenomenon most clearly seen in the 10 Hz band is widely known as "event-related desynchronization" or ERD. This is an unfortunate term, but originates from the 1980's when the first researchers discovered the phenomenon assigned the amplitude change to a change in synchrony between neurons (causing a smaller macroscopic field). Naturally, the oscillation amplitudes can also attenuate because of certain neurons transiently not firing action potentials or firing action potentials at a lower rate. | + | The phenomenon most clearly seen in the 10 Hz band is widely known as "event-related desynchronization" or ERD. This is an unfortunate term, but originates from the 1980's when the first researchers discovered the phenomenon and assigned the amplitude change to a change in synchrony between neurons (causing a smaller macroscopic field). Naturally, the oscillation amplitudes can also attenuate because of certain neurons transiently not firing action potentials or firing action potentials at a lower rate. |

Line 287: | Line 288: | ||

<code> | <code> | ||

>> nFFT = 2^9; | >> nFFT = 2^9; | ||

- | >> overlap = nFFT/2 | + | >> overlap = nFFT/2; |

>> [Coherence_LSM_RSM,f] = mscohere(LSM,RSM,hanning(nFFT),overlap,nFFT,Fs); | >> [Coherence_LSM_RSM,f] = mscohere(LSM,RSM,hanning(nFFT),overlap,nFFT,Fs); | ||

>> plot(f,Coherence_LSM_RSM,'k') | >> plot(f,Coherence_LSM_RSM,'k') | ||

Line 308: | Line 309: | ||

Also try to shift the data of the two channels in time (e.g., compute the coherence between the first half of the data in RSM with the second half of the data in LSM). | Also try to shift the data of the two channels in time (e.g., compute the coherence between the first half of the data in RSM with the second half of the data in LSM). | ||

- | What do you see and why? | + | **Question:**\\ |

+ | What do you see and why?\\ | ||

Ask if you are in doubt how to shift the samples in the two signals relative to each other. | Ask if you are in doubt how to shift the samples in the two signals relative to each other. | ||

- | + | <html> | |

+ | <script type="text/javascript"><!-- | ||

+ | google_ad_client = "ca-pub-8640848843881724"; | ||

+ | /* nbtwikibundbar */ | ||

+ | google_ad_slot = "2215324537"; | ||

+ | google_ad_width = 728; | ||

+ | google_ad_height = 90; | ||

+ | //--> | ||

+ | </script> | ||

+ | <script type="text/javascript" | ||

+ | src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> | ||

+ | </script></html> | ||