[FieldTrip] Different way of calculating the covariance for LCM

Jean-Michel Badier jean-michel.badier at univmed.fr
Thu Mar 24 12:19:02 CET 2011

Hello all,

Thanks again for the discussion.
So now we have to deal with both theoretical consideration and practical 
implementation of the algorithms within fieldtrip.

Let me first comment the previous message:

Le 23/03/11 10:42, Yuval Harpaz a écrit :
> I checked it again, I used a data structure 'D1st' which included 90 
> trials.
> I ran the following script and the result was a 'pre' structure. field 
> pre.cov was a 90*248*248 matrix, i.e., the covariance was estimated 
> for all the trials.
> cfg = [];
> cfg.covariance = 'yes';
> cfg.removemean = 'no';
> cfg.covariancewindow = [-0.1 0];
> cfg.channel='MEG';
> cfg.keeptrials         = 'yes' ;
> pre=ft_timelockanalysis(cfg, D1st);
> you may find this script repository useful for LCMV analysis. it 
> includes an older version of fieldtrip but this is the one we work with.
> http://yuval-harpaz.github.com/ft_BIU/
> check the actual repository here (read the README) : 
> https://github.com/yuval-harpaz/ft_BIU
> good luck there, yuval.
Yes I do agree that with cfg.keeptrials = 'yes' you will get an estimate 
of the covariance for each trial, in this case 90.
However the covariance will be averaged within fr_sourceanalysis before 
the call to beamformer_lcmv

see for example in version 20110222 ft_sourceanalysis from line 783
   elseif Ntrials>1
     % average the single-trial covariance matrices
     Cy  = reshape(mean(data.cov,1), [Nchans Nchans]);
     % select the average ERF
     avg = data.avg;
     Nrepetitions = 1;

of course developers of fieldtrip would be the experts to comment on this.


More information about the fieldtrip mailing list