Home > vbmeg > external > mne > mne_combine_xyz.m

mne_combine_xyz

PURPOSE ^

SYNOPSIS ^

function [comb] = mne_combine_xyz(vec)

DESCRIPTION ^

 function [comb] = mne_combine_xyz(vec)

 Compute the three Cartesian components of a vector together


 vec         - Input row or column vector [ x1 y1 z1 ... x_n y_n z_n ]
 comb        - Output vector [x1^2+y1^2+z1^2 ... x_n^2+y_n^2+z_n^2 ]

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [comb] = mne_combine_xyz(vec)
0002 %
0003 % function [comb] = mne_combine_xyz(vec)
0004 %
0005 % Compute the three Cartesian components of a vector together
0006 %
0007 %
0008 % vec         - Input row or column vector [ x1 y1 z1 ... x_n y_n z_n ]
0009 % comb        - Output vector [x1^2+y1^2+z1^2 ... x_n^2+y_n^2+z_n^2 ]
0010 %
0011 
0012 %
0013 %
0014 %   Author : Matti Hamalainen, MGH Martinos Center
0015 %   License : BSD 3-clause
0016 %
0017 %   Revision 1.1  2006/05/05 03:50:40  msh
0018 %   Added routines to compute L2-norm inverse solutions.
0019 %   Added mne_write_inverse_sol_stc to write them in stc files
0020 %   Several bug fixes in other files
0021 %
0022 %
0023 
0024 me = 'MNE:mne_combine_xyz';
0025 if nargin ~= 1
0026     error(me,'Wrong number of arguments');
0027 end
0028 if size(vec,1) > size(vec,2)
0029     vec = vec';
0030 end
0031 if size(vec,1) ~= 1 || mod(size(vec,2),3) ~= 0
0032     error(me,'Input must be a row or a column vector with 3N components');
0033 end
0034 
0035 s = mne_block_diag(vec,3);
0036 comb = full(diag(s*s'));
0037 if size(vec,1) > size(vec,2)
0038     comb = comb';
0039 end
0040 
0041 return;
0042

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005