Question on Surface Laplacian

I am working on a pre-processed data set which was recorded with BioSemi 256 channel net. As a next step, I was running Surface Laplacian using the Matlab code which was provided with your book ‘Analyzing Neural time Series Data’. But when I plot them, it does not look right. I am interested in mu ERD/ERS over the motor cortex so I included only Cz(A1), C4(G16), and C3(C23) in the code below. Could you please let me know what I need to do to fix this? Just in case here is the link to the data set.
Thank you so much.

chan1 = ‘A1’;
chan2 = ‘G23’;
chan2 = ‘C23’;
chan3 = ‘G16’;

eucdist1 = zeros(1, 256);
eucdist2 = zeros(1, 256);
eucdist3 = zeros(1, 256);

chan1idx = strcmpi(chan1, {EEG.chanlocs.labels});
chan2idx = strcmpi(chan2, {EEG.chanlocs.labels});
chan3idx = strcmpi(chan3, {EEG.chanlocs.labels});

for chani=1:EEG.nbchan
eucdist1(chani) = sqrt( (EEG.chanlocs(chani).X-EEG.chanlocs(chan1idx).X)^2 + (EEG.chanlocs(chani).Y-EEG.chanlocs(chan1idx).Y)^2 + (EEG.chanlocs(chani).Z-EEG.chanlocs(chan1idx).Z)^2 );
eucdist2(chani) = sqrt( (EEG.chanlocs(chani).X-EEG.chanlocs(chan2idx).X)^2 + (EEG.chanlocs(chani).Y-EEG.chanlocs(chan2idx).Y)^2 + (EEG.chanlocs(chani).Z-EEG.chanlocs(chan2idx).Z)^2 );
eucdist3(chani) = sqrt( (EEG.chanlocs(chani).X-EEG.chanlocs(chan3idx).X)^2 + (EEG.chanlocs(chani).Y-EEG.chanlocs(chan3idx).Y)^2 + (EEG.chanlocs(chani).Z-EEG.chanlocs(chan3idx).Z)^2 );

hi_spatfreq = 2exp(- (eucdist1.^2)/(295^2) );
lo_spatfreq = exp(- (eucdist2.^2)/(250^2) ) + exp(- (eucdist3.^2)/(250^2) );

title(‘Low spatial frequency feature’)

title(‘High spatial frequency features’)

title(‘Low+high features’)

Hi eeom. What exactly are you trying to do with that code? That’s the code I used to illustrate a concept in one of the figures; you don’t need that for data processing. You can apply the Laplacian function directly to your data.

Otherwise, I’m not sure why the maps are all red. It could be the values or the color limits. Perhaps the scaling factors in the Gaussian (250^2 and 295^2) would need to be adjusted.


Hi Mike,

Thank you so much for your reply. I want to run the Surface Laplacian to reduce noise as the data was collected with 256 channels and I need to analyze signals from Cz, C3, and C4. Could you please let me know how I can apply the Laplacian function directly on Matlab? No one in my lab knows either TF analysis or Matlab. Thank you so much.

You can use the function laplacian_perrinX.m. I show how to use this on real data in the book code. The code you pasted in previously was only used to illustrate the concept of spatial frequencies in EEG.

Hi Mike,

Oh I see. Thank you so much!! I’ll try the function, laplacian_perrinX.m, Thank you!