# std\_ersp还是newtimef

[ref](https://sccn.ucsd.edu/pipermail/eeglablist/2012/005319.html)

for computing ERSP at the single dataset level, you should use the newtimef function. The std\_ersp.m function is for STUDY. As outlined in the function documentation, by default the function processes ICA components. To make it process data channels, you have to provide them as input.

```
std_ersp(EEG, 'channels', {EEG.chanlocs(1).labels}, 'type', 'ersp', 'freqs', [2 20], 'timelimits', [0 1800], 'cycles',  [3 0.5], 'trialindices', [1:EEG.trials]);
```

This will save a datafile that has the same name as the EEG dataset with the extension `.datersp`. You may load the file below

```
dat = load('-mat', fullfile(EEG.filepath, [ EEG.filename(1:end-4) '.datersp');
```

Then you may replot the data

```
figure; 
tftopo(dat.chan1_ersp, dat.times, dat.freqs);
```

A lot of efforts. Better use the newtimef function unless you want to compute time/frequency decomposition on all data channels or components.
