The Linearly-Constrained Minimum Variance (LCMV) beamformer is a type of beamformer which can be applied to evoked fields (i.e. data obtained through timelockanalysis). The necessary ingredient for sourceanalysis in this case is the covariance-matrix between all sensor pairs. In order for the beamformer to work, this should be the covariance of (a particular latency window) of the averaged single trials. This is essentially different from the average covariance of the single trials. Therefore, we have to call timelockanalysis more than once: the first time we obtain the evoked field, and the second time we obtain the covariance matrix/ces at interesting latency/ies. The data used to generate the figures for the following script was obtained from a 248-sensor 4D-neuroimaging magnetometer system. The subject was presented with two visual stimuli in the lower left and right visual hemifield. In order to execute the following script, you need the following things:
cfg = []; cfg.blc = 'yes'; cfg.blcwindow = [-0.2 0]; tlckavg = timelockanalysis(cfg, data); FIXME: plot the field here cfg = []; cfg.covariance = 'yes'; cfg.covariancewindow = [0.15 0.17]; cfg.removemean = 'no'; tlckavgpst = timelockanalysis(cfg, tlckavg); cfg.covariancewindow = [-0.05 -0.03]; tlckavgpre = timelockanalysis(cfg, tlckavg); cfg = []; cfg.method = 'lcmv'; cfg.grid = grid; cfg.vol = vol; cfg.lambda = '5%'; sourcepst = sourceanalysis(cfg, tlckavgpst); sourcepre = sourceanalysis(cfg, tlckavgpre); sourcepst.avg.nai = sourcepst.avg.pow./sourcepre.avg.pow; cfg = []; cfg.funparameter = 'nai'; cfg.method = 'ortho'; cfg.location = 'max'; figure;sourceplot(cfg, sourcepst);