CSD - Compute current source density. USAGE csd = CSD(lfp) lfp local field potential <a href="matlab:help samples">samples</a> SEE See also PlotCSD.
0001 function csd = CSD(lfp) 0002 0003 %CSD - Compute current source density. 0004 % 0005 % USAGE 0006 % 0007 % csd = CSD(lfp) 0008 % 0009 % lfp local field potential <a href="matlab:help samples">samples</a> 0010 % 0011 % SEE 0012 % 0013 % See also PlotCSD. 0014 0015 % Copyright (C) 2008-2011 by Michaƫl Zugaro 0016 % 0017 % This program is free software; you can redistribute it and/or modify 0018 % it under the terms of the GNU General Public License as published by 0019 % the Free Software Foundation; either version 3 of the License, or 0020 % (at your option) any later version. 0021 0022 % Check number of parameters 0023 if nargin < 1, 0024 error('Incorrect number of parameters (type ''help <a href="matlab:help CSD">CSD</a>'' for details).'); 0025 end 0026 0027 t = lfp(:,1); 0028 y = lfp(:,2:end); 0029 y = y - repmat(mean(y),length(t),1); 0030 d = -diff(y,2,2); 0031 csd = [t d];