# [FieldTrip] power-frequency figure

Jinyi Long longjinyi at gmail.com
Fri Nov 7 16:13:15 CET 2014

```Thanks Tzvetan.

2014-11-07 8:56 GMT-05:00 Tzvetan Popov <tzvetan.popov at uni-konstanz.de>:

> Dear Jinyi,
> what you’re referring to is time-frequency analysis. From your e-mail I
> assumed that you’ve already performed frequency analysis, yet apparently
> not. You can compute the power spectrum bei using something like this:
>
> cfg              = [];
> cfg.output       = 'pow';
> cfg.method       = 'mtmfft';
> cfg.taper        = 'dpss';
> cfg.foilim       = [1 20];
> cfg.tapsmofrq    = 2;
> fft_data= ft_freqanalysis(cfg,data);
>
> Subsequently you can plot fft_data with the functions I mentioned in my
> previous e-mail.
> Note that we have also a video lectures section where you can get some
> detailed insight into frequency domain analysis. Please have a look here:
> http://fieldtrip.fcdonders.nl/video
> and also here
>
>
> best
> tzvetan
>
> 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>:
>
>> 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>:
>> >
>> > 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
>> > http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
> _______________________________________________
> fieldtrip mailing list
> 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/92e2deaf/attachment-0002.html>
```