<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Dear Brian,<br>
    <br>
    I got the same error a while ago, which was caused by a wrong
    segementation/triangulation of the volume (it was a bug in
    FieldTrip). Are you using the newest version of FieldTrip? It should
    be solved there. <br>
    In any case, it would be wise to check your segmentation and
    triangulation. You can do so with ft_plot_vol and ft_plot_mesh,
    e.g.:<br>
    <i><small>        figure;hold on;<br>
                ft_plot_vol(hdm, 'edgecolor', 'none');alpha 0.5;camlight<br>
                ft_plot_mesh(hdm.bnd); </small></i><br>
    <br>
    Hope it helps!<br>
    Best,<br>
    Jörn<br>
    <br>
    On 10/26/2011 12:08 PM, <a class="moz-txt-link-abbreviated" href="mailto:B.Mouthaan@neuro.umcn.nl">B.Mouthaan@neuro.umcn.nl</a> wrote:
    <blockquote
      cite="mid:C1B628236A6B6B4AA11AE3022559568494D9CA@UMCEXBE04.umcn.nl"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="MS Exchange Server version
        6.5.7651.53">
      <title>Creating Leadfield using BEM</title>
      <!-- Converted from text/plain format -->
      <p><font size="2">Dear Fieldtrippers,<br>
          <br>
          I am trying to compute a beamform localisation using a
          BEM-model of the head. When I call ft_sourceanalysis i receive
          to following error.<br>
          <br>
          ??? Error using ==> svd<br>
          Input to SVD must not contain NaN or Inf.<br>
          <br>
          Error in ==> beamformer_lcmv>pinv at 367<br>
            [U,S,V] = svd(A,0);<br>
          <br>
          Error in ==> beamformer_lcmv at 255<br>
              filt = pinv(lf' * invCy * lf) * lf' * invCy;             
          % van Veen eqn. 23, use PINV/SVD to cover rank deficient
          leadfield<br>
          <br>
          Error in ==> ft_sourceanalysis at 818<br>
                dip(i) = beamformer_lcmv(grid, sens, vol,
          squeeze(avg(i,:,:)), squeeze(Cy(i,:,:)), optarg{:});<br>
          <br>
          <br>
          I noticed that my leadfieldgrid containend NaN values. I think
          this could be the cause, but I don't know how to fix this
          problem. Does anyone have an idea?<br>
          <br>
          My script is as follows<br>
          <br>
          vol=ft_read_vol('standard_vol.mat')<br>
          elec=ft_read_sens('standard_1005.elc') % reading the 1005
          systeem because the experiment used of 32 electrodes<br>
          <br>
          cfg=[]<br>
          cfg.showlabels= 'yes'<br>
          cfg.layout='EEG1010.lay'<br>
          cfg.interactive= 'yes'<br>
          <br>
          <br>
          % Reref<br>
          load
          (['C:\Users\Brian\Documents\MATLAB\AnalysisM\differencewave0'
          Subject])<br>
          <br>
          cfg=[]<br>
          cfg.reref='yes' % referring the<br>
          cfg.refchannel= 'all' % commonaverage reference<br>
          diff=ft_preprocessing(cfg,diffwav)<br>
          <br>
          %% Creating LEADFIELD<br>
          cfg                 = [];<br>
          cfg.elec            = elec;<br>
          cfg.vol             = vol;<br>
          cfg.reducerank      = 3;<br>
          cfg.channel         = 'all';<br>
          cfg.grid.resolution = 10;   % use a 3-D grid with a 10 mm
          resolution<br>
          [grid] = ft_prepare_leadfield(cfg);<br>
          <br>
          save('AnalysisM\Grid_10mm', 'grid')<br>
          <br>
          %%<br>
          cfg                  = [];<br>
          cfg.covariance       = 'yes';<br>
          cfg.covariancewindow = [0 .75];<br>
          cfg.removemean       = 'no';<br>
          tlckavgpst           = ft_timelockanalysis(cfg, diff);<br>
          cfg.covariancewindow = [-0.25 0];<br>
          tlckavgpre           = ft_timelockanalysis(cfg, diff);<br>
          <br>
          <br>
          %%<br>
          cfg        = [];<br>
          cfg.method = 'lcmv';<br>
          cfg.vol    = vol;<br>
          cfg.elec   = elec<br>
          cfg.lambda = '5%'; <br>
          sourcepst  = ft_sourceanalysis(cfg, tlckavgpst);<br>
          sourcepre  = ft_sourceanalysis(cfg, tlckavgpre);<br>
          <br>
          sourcepst.avg.nai = sourcepst.avg.pow./sourcepre.avg.pow;<br>
          <br>
          <br>
          Thanks in advance!<br>
          <br>
          Brian<br>
          <br>
          <br>
        </font>
      </p>
      <br clear="all">
      <p style="font-size:13px;font-family:arial;"> Het UMC St Radboud
        staat geregistreerd bij de Kamer van Koophandel in het
        handelsregister onder nummer 41055629.<br>
        The Radboud University Nijmegen Medical Centre is listed in the
        Commercial Register of the Chamber of Commerce under file number
        41055629.<br>
      </p>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
fieldtrip mailing list
<a class="moz-txt-link-abbreviated" href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>
<a class="moz-txt-link-freetext" href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour 
Centre for Cognitive Neuroimaging
Radboud University Nijmegen 
Neuronal Oscillations Group

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

Contact:
E-Mail: <a class="moz-txt-link-abbreviated" href="mailto:jm.horschig@donders.ru.nl">jm.horschig@donders.ru.nl</a>
Tel:    +31-(0)24-36-68493
Web: <a class="moz-txt-link-freetext" href="http://www.ru.nl/donders">http://www.ru.nl/donders</a>

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands</pre>
  </body>
</html>