How to plot a time-frequency representation and power spectrum of a single channel

A simple way to explore your signal is to plot the time-frequency representation (TF-plot) and power spectrum. The TF-plot will tell you how the power in different frequency bands changes over time, and the power spectrum shows you the time-averaged power.

To plot a time-frequency representation and power spectrum in NBT you can use this function. Open the GUI, load a NBT signal, and go to Visualization|Plot time-frequency plot and power spectrum of one channel. A dialog window will ask you to specify plot parameters. You can, e.g., set the 'print PDF' to 1, and a PDF file of the plot will be saved, or you can change the frequency range. You can also change these parameters directly from the plot.

Click 'OK' when you are done. A window like this will pop-up:

In the top of the window you see the TF-plot, in the case shown you see clear alpha (10 Hz) activity during the whole recording. Using the slide bar you can change the color scale of the plot. You can also set the color scale by clicking on the Edit plot parameters button, and change the color interval parameter to, e.g., 0 100. You can change between channels by clicking on the desired channels in the middle listbox, or by right-clicking on the topographic plot on the channel (in case of EEG data). Finally, you can compute the TF-plot using wavelets instead of multi-tapers, which will give a more smooth image.

In the left corner you see the power spectrum, in this case a clear 10 Hz peak is present.

To compute and store amplitudes in several frequency bands, go to the tutorial Computing amplitudes in the classical frequency bands.

Command line usage

You can also plot the TF-plot and spectrum using the the command line:

nbt_plot_TF_and_spectrum_one_channel(Signal,SignalInfo,channel_nr,frequency_interval,nFFT,plotting)

Inputs:
-Signal is a NBT Signal matrix (no default)
-SignalInfo is the corresponding Info object (no default)
-channel_nr is the number of the channel you want to use (default = 1)
-frequency_interval is the frequency interval that is used to depict the
time-frequency representation and the power spectrum. (default = [1 45])
-nFFT is number of fast Fourier transforms, higher this number and the frequency resolution goes up,
but the time resolution goes down (default = 2^10)
-plotting. If plotting = 1, then a pdf plot will be generated in current
directory. (default = 0)

For example,

nbt_plot_TF_and_spectrum_one_channel(Signal,SignalInfo,5,[1 40],[],1)

The inputs that have a default are not obligatory, for example

plot_TF_and_spectrum_one_channel(Signal,SignalInfo)

will plot channel number 1 with all the default settings for the other parameters.

tutorial/plot_a_time-frequency_representation_and_power_spectrum_of_a_single_channel.txt · Last modified: 2014/04/07 23:56 by Simon-Shlomo Poil
The NBTwiki platform - version 2.8 - 9 May 2013
Copyright (C) 2008-2015