Home > vbmeg > functions > leadfield > spherical_harmo > vb_spherical_harmo_V.m

vb_spherical_harmo_V

PURPOSE ^

spherical harmonics V

SYNOPSIS ^

function [V, valid] = vb_spherical_harmo_V(n, m, G, Itbl, p_z_m, c_s)

DESCRIPTION ^

 spherical harmonics V
 [usage]
   [V, valid] = vb_spherical_harmo_V(n, m, G, Itbl, p_z_m, c_s)
 [input]
       n : index of n-term of legendre
       m : index of m-term of legendre
       G : spherical harmonics functions
    Itbl : index table of n and m for cosine and sine (n x m x 2)
   p_z_m : [string] plus('+') or zero('0') or minus('-')
     c_s : [short]  cosine or sine flag : 0(cosine), 1(sine)
 [output]
       V : calculated V-term
   valid : validity of this calculation (true or false)
 [note]

 [history]
   2006.06.22 (Sako) initial version

 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:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [V, valid] = vb_spherical_harmo_V(n, m, G, Itbl, p_z_m, c_s)
0002 % spherical harmonics V
0003 % [usage]
0004 %   [V, valid] = vb_spherical_harmo_V(n, m, G, Itbl, p_z_m, c_s)
0005 % [input]
0006 %       n : index of n-term of legendre
0007 %       m : index of m-term of legendre
0008 %       G : spherical harmonics functions
0009 %    Itbl : index table of n and m for cosine and sine (n x m x 2)
0010 %   p_z_m : [string] plus('+') or zero('0') or minus('-')
0011 %     c_s : [short]  cosine or sine flag : 0(cosine), 1(sine)
0012 % [output]
0013 %       V : calculated V-term
0014 %   valid : validity of this calculation (true or false)
0015 % [note]
0016 %
0017 % [history]
0018 %   2006.06.22 (Sako) initial version
0019 %
0020 % Copyright (C) 2011, ATR All Rights Reserved.
0021 % License : New BSD License(see VBMEG_LICENSE.txt)
0022 
0023 V = zeros(size(G,1),1);
0024 valid = true;
0025 
0026 if c_s ~= 0 & c_s ~= 1
0027   disp('c_s is allowed to set 0(cosine) or 1(sine)');
0028   valid = false;
0029   return;
0030 end
0031 
0032 nn = n+1;
0033 
0034 switch  p_z_m
0035   case  '+'
0036     b  = b_param(n,m,'+');
0037     mm = m+1;
0038     V  = vb_get_spherical_harmo(nn,mm,G,Itbl,c_s);
0039     V  = b * V;
0040     
0041   case  '-'
0042     b = b_param(n,m,'-');
0043     mm = m-1;
0044     V  = vb_get_spherical_harmo(nn,mm,G,Itbl,c_s);
0045     V  = b * V;
0046     
0047   case  '0'
0048     b = b_param(n,m,'0');
0049     mm = m;
0050     V  = vb_get_spherical_harmo(nn,mm,G,Itbl,c_s);
0051     V  = b * V;
0052     
0053   otherwise
0054 end
0055 
0056 
0057 % func : calculate 'b' value
0058 % [usage]
0059 %   b = b_param( n, m, p_z_m )
0060 % [input]
0061 %       n : index of n-term of legendre
0062 %       m : index of m-term of legendre
0063 %   p_z_m : plus('+') or zero('0') or minus('-')
0064 % [output]
0065 %       b : calculated 'b' value
0066 function b = b_param(n,m,p_z_m)
0067 
0068 % Normalized Legendre function case
0069   switch  p_z_m
0070     case  '+'
0071           b = (n+m+2)*(n+m+1)*(2*n+1)/(2*n+3);
0072           b = -sqrt(b);
0073     case  '-'
0074           b = (n-m+2)*(n-m+1)*(2*n+1)/(2*n+3);
0075           b = sqrt(b);
0076     case  '0'
0077           b = (n+m+1)*(n-m+1)*(2*n+1)/(2*n+3);
0078           b = -sqrt(b);
0079   end
0080

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