# [FieldTrip] power-frequency figure

Lam, N.H.L. (Nietzsche) n.lam at fcdonders.ru.nl
Fri Nov 7 14:55:01 CET 2014

```Hi Jinyi,

The name of the function gives you a clue on what function to use for plotting. ft_singleplotER  vs. ft_singleplotTFR.
ER for event-related potentials/fields, and TFR = time frequency data.

Please take a look at this tutorial, all the questions you have asked can be found here: http://fieldtrip.fcdonders.nl/tutorial/timefrequencyanalysishttp://fieldtrip.fcdonders.nl/tutorial/timefrequencyanalysis

Nietzsche
________________________________
From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Jinyi Long [longjinyi at gmail.com]
Sent: 07 November 2014 14:24
To: FieldTrip discussion list
Subject: Re: [FieldTrip] power-frequency figure

Dear Tzvetan, Thanks for your help. First, to plot the spectral power for one channel with the 'ft_singleplotER', how can I calculate the power spectrum with 'ft_freqanalsis'? Can I use the following code to calculate and plot power spectrum? Thanks a lot!

Best,
Jinyi

%% frequency analysis
cfg              = [];
cfg.output       = 'pow';%'fourier';%
% cfg.channel      = 'MEG';
cfg.method       = 'mtmconvol';
cfg.taper        = 'hanning';
cfg.foi          = 2:1:40;                         % analysis 2 to 30 Hz in steps of 2 Hz
cfg.t_ftimwin    = ones(length(cfg.foi),1).*0.5;   % length of time window = 0.5 sec
cfg.toi          = -0.5:0.05:4;                  % time window "slides" from -0.5 to 1.5 sec in steps of 0.05 sec (50 ms)
TFRhann = ft_freqanalysis(cfg, data);
%% visualize
cfg = [];
cfg.baseline     = [-0.9 -0.1];
cfg.baselinetype = 'absolute';
cfg.zlim         = [-3e-7 3e-7];    %
cfg.channel      = '26';
figure
ft_singleplotER(cfg, TFRhann)

2014-11-07 1:33 GMT-05:00 Tzvetan Popov <tzvetan.popov at uni-konstanz.de<mailto:tzvetan.popov at uni-konstanz.de>>:
Dear Jinyi,
You can use ft_singleplotER to plot the power spectrum of a single channel. If you are interested in the same but for multiple channels than use ft_multiplotER. Finally if you are interested in the topography of a particular frequency you'd specify it in cfg.xlim=[begin end] and call ft_topoplotER.
Good luck
Tzvetan

> Am 07.11.2014 um 00:23 schrieb Jinyi Long <longjinyi at gmail.com<mailto:longjinyi at gmail.com>>:
>
> Dear Sir/Madam, Thanks for your powerful tool. Now I have one question. When I perform the frequency analysis with the function of 'ft_freqanalaysis', how can I plot the power-frequency figure but not 2D time-frequency figure at single channel? Thanks!
>
> Best,
> Jinyi
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20141107/091d06d6/attachment-0002.html>
```