EEG采集的信号是原始信号的多个叠加的结果，因此在计算conectivity的时候 要非常的小心

with  caution!

#### Simulated data with common pick-up and different noise levels

when working withe EEG singal that are picked up by the individual channels invariablely consisit of instant mixtures of the underlying source singals.

This mixing can severely affect the outcome of connectivity analysis, and thus affects the interpretation.

this mixing would effect the outcome of connecitvity and affect the interpration.

We will demonstrate this by simulating data in 2 channels, where each of the channels consists of a weighted combination of temporally white noise unique to each of the channels, and a common input of a band-limited signal (filtered between 15 and 25 Hz).

we will compute the connecvity between the channels  to show that the common input could give a rise to spuorious estimates of conecitivity

```% create some instantaneously mixed data

% define some variables locally
nTrials  = 100;
nSamples = 1000;
fsample  = 1000;

% mixing matrix
mixing   = [0.8 0.2 0;
0 0.2 0.8];

data       = [];
data.trial = cell(1,nTrials);
data.time  = cell(1,nTrials);
for k = 1:nTrials
dat = randn(3, nSamples);
dat(2,:) = ft_preproc_bandpassfilter(dat(2,:), 1000, [15 25]);
dat = 0.2.*(dat-repmat(mean(dat,2),[1 nSamples]))./repmat(std(dat,[],2),[1 nSamples]);
data.trial{k} = mixing * dat;
data.time{k}  = (0:nSamples-1)./fsample;
end
data.label = {'chan1' 'chan2'}';

figure;plot(dat'+repmat([0 1 2],[nSamples 1]));
title('original ''sources''');

figure;plot((mixing*dat)'+repmat([0 1],[nSamples 1]));
axis([0 1000 -1 2]);
set(findobj(gcf,'color',[0 0.5 0]), 'color', [1 0 0]);
title('mixed ''sources''');

```% do spectral analysis
cfg = [];
cfg.method    = 'mtmfft';
cfg.output    = 'fourier';
cfg.foilim    = [0 200];
cfg.tapsmofrq = 5;
freq          = ft_freqanalysis(cfg, data);
fd            = ft_freqdescriptives(cfg, freq);

figure;plot(fd.freq, fd.powspctrm);
set(findobj(gcf,'color',[0 0.5 0]), 'color', [1 0 0]);
title('power spectrum');

```% compute connectivity
cfg = [];
cfg.method = 'granger';
g = ft_connectivityanalysis(cfg, freq);
cfg.method = 'coh';
c = ft_connectivityanalysis(cfg, freq);
```
```% visualize the results
cfg = [];
cfg.parameter = 'grangerspctrm';
figure;ft_connectivityplot(cfg, g);
cfg.parameter = 'cohspctrm';
figure;ft_connectivityplot(cfg, c);

```