Home > subfunctions > ccl_math_uvec.m

ccl_math_uvec

PURPOSE ^

alpha = ccl_math_uvec (Theta)

SYNOPSIS ^

function alpha = ccl_math_uvec (Theta)

DESCRIPTION ^

 alpha = ccl_math_uvec (Theta)

 Convert constraint parameters to constraint vectors e.g. for 3D problem
 a1 = cos(theta1)
 a2 = sin(theta1)*cos(theta2)
 a3 = sin(theta1)*sin(theta2)
 a = [a1,a2,a3]'

 Input:
   Theta                                 Learnt constraint parameters

 Output:
   alpha                                 A unit vector of constraint basis

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function alpha = ccl_math_uvec (Theta)
0002 % alpha = ccl_math_uvec (Theta)
0003 %
0004 % Convert constraint parameters to constraint vectors e.g. for 3D problem
0005 % a1 = cos(theta1)
0006 % a2 = sin(theta1)*cos(theta2)
0007 % a3 = sin(theta1)*sin(theta2)
0008 % a = [a1,a2,a3]'
0009 %
0010 % Input:
0011 %   Theta                                 Learnt constraint parameters
0012 %
0013 % Output:
0014 %   alpha                                 A unit vector of constraint basis
0015 
0016 [dim_n dim_t]   = size(Theta) ;
0017 alpha           = zeros(dim_n,dim_t+1) ;
0018 alpha(:,1)      = cos(Theta(:,1)) ;
0019 for i =2:dim_t
0020     alpha(:,i) = cos(Theta(:,i)) ;
0021     
0022     for k = 1:i-1
0023         alpha(:,i) = alpha(:,i) .* sin(Theta(:,k)) ;
0024     end
0025 end
0026 alpha(:,dim_t+1)    = ones(dim_n,1) ;
0027 for k = 1:dim_t
0028     alpha(:,dim_t+1) = alpha(:,dim_t+1) .* sin(Theta(:,k)) ;
0029 end
0030 end

Generated on Mon 01-Jan-2018 15:49:39 by m2html © 2005