Home > functions > estimation > bayes > vb_convert_current_1d.m

vb_convert_current_1d

PURPOSE ^

Convert current vector to scalar based on normal vector on cortex

SYNOPSIS ^

function J = vb_convert_current_1d(J0,V,xx,L)

DESCRIPTION ^

 Convert current vector to scalar based on normal vector on cortex

 --- Syntax
 J = vb_convert_current_1d(J0,V,xx,L)

 --- Input
 J0: IL-by-T matrix (current vector components)
 V : I-by-3 matrix (vertex position)
 xx: I-by-3 matrix (principal dipole direction)
 L : Scalar (dipole number at each vertex)

 --- Output
 J : I vector

 --- History
 2007-03-13 Taku Yoshioka

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function J = vb_convert_current_1d(J0,V,xx,L)
0002 % Convert current vector to scalar based on normal vector on cortex
0003 %
0004 % --- Syntax
0005 % J = vb_convert_current_1d(J0,V,xx,L)
0006 %
0007 % --- Input
0008 % J0: IL-by-T matrix (current vector components)
0009 % V : I-by-3 matrix (vertex position)
0010 % xx: I-by-3 matrix (principal dipole direction)
0011 % L : Scalar (dipole number at each vertex)
0012 %
0013 % --- Output
0014 % J : I vector
0015 %
0016 % --- History
0017 % 2007-03-13 Taku Yoshioka
0018 %
0019 % Copyright (C) 2011, ATR All Rights Reserved.
0020 % License : New BSD License(see VBMEG_LICENSE.txt)
0021 
0022 if L==1, J=J0; return; end
0023 
0024 % Calculate vector current
0025 I = size(V,1);
0026 T = size(J0,2);
0027 [V,xx_L] = vb_current_vector(V,xx,L);
0028 Jx = J0.*repmat(xx_L(:,1),[1 T]);
0029 Jy = J0.*repmat(xx_L(:,2),[1 T]);
0030 Jz = J0.*repmat(xx_L(:,3),[1 T]);
0031 
0032 switch L
0033  case 2,
0034   Jx = Jx(1:I,:)+Jx(I+1:2*I,:);
0035   Jy = Jy(1:I,:)+Jy(I+1:2*I,:);
0036   Jz = Jz(1:I,:)+Jz(I+1:2*I,:);
0037  case 3,
0038   Jx = Jx(1:I,:)+Jx(I+1:2*I,:)+Jx(2*I+1:3*I,:);
0039   Jy = Jy(1:I,:)+Jy(I+1:2*I,:)+Jy(2*I+1:3*I,:);
0040   Jz = Jz(1:I,:)+Jz(I+1:2*I,:)+Jz(2*I+1:3*I,:);
0041 end
0042 
0043 % Directional cosine
0044 J = Jx.*repmat(xx(:,1),[1 T])+Jy.*repmat(xx(:,2),[1 T]) ...
0045     +Jz.*repmat(xx(:,3),[1 T]);

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005