Source analysis error

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Mon Nov 7 14:34:31 CET 2005


Hi Philip,

I have tried to replicate your problem. I do not have the same
dataset, but a 151 channel dataset gave the same error.

On 3-nov-2005, at 22:19, Philip C. Bikle wrote:

> I get the following error when attempting to source analysis:
>
> Warning: cross-spectral density matrix is rank deficient
>> In fieldtrip-20051027/private/beamformer at 253
>   In sourceanalysis at 701
> ??? Error using ==> mtimes
> Inner matrix dimensions must agree.
>
> Error in ==> fieldtrip-20051027/private/beamformer at 365
>           filt2 = pinv(lf2' * invCf * lf2) * lf2' * invCf;

I looked in the code and set a breakpoint at the corresponding line.
It turned out that lf2 was 184x3 instead of 151x3. Our 151 channel
system has 184 channels in total, including the reference channels.

> cfg = [];
> cfg.xgrid = -12:1:12;
> cfg.ygrid = -10:1:10;
> cfg.zgrid = -3:1:14;
> cfg.dim = [length(cfg.xgrid) length(cfg.ygrid) length(cfg.zgrid)];
> N=prod(cfg.dim);
> cfg.inside = 1:N;
> cfg.outside = [];

(Side note, this should be cfg.grid.inside and cfg.grid.outside to
have effect.)

> cfg.hdmfile = strcat(ds, '/localSpheres.hdm');
> [grid] = PREPARE_LEADFIELD(cfg, freq);

It turns out that you are pre-computing the leadfields on all
channels, including the reference channels. Instead, you should only
compute it on the channels which you want to use for source analysis.
If you do cfg.channel = 'MEG' in prepare_leadfield, the right
channels will be selected.

best,
Robert



More information about the fieldtrip mailing list