bayes_sphcoff
PURPOSE
function [sp_coff,error_check, sp_mat] = bayes_sphcoff(nmax,xelec,yelec,zelec,v,lambda)
SYNOPSIS
function [sp_coff,error_check, sp_mat] = bayes_sphcoff(nmax,xelec,yelec,zelec,v,lambda)
DESCRIPTION
CROSS-REFERENCE INFORMATION
This function calls:
This function is called by:
SOURCE CODE
0001 function [sp_coff,error_check, sp_mat] = bayes_sphcoff(nmax,xelec,yelec,zelec,v,lambda)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 if ~(nargin == 5|nargin == 6)
0020 error('improper parameter list')
0021 end;
0022
0023 [azelec,elelec,relec] = cart2sph(xelec,yelec,zelec);
0024 elelec = (pi/2)*ones(size(elelec,1),size(elelec,2)) - elelec;
0025
0026 icount = 1;
0027
0028 for j=1:nmax
0029 sp_mat(icount:icount+2*j,:) = sph_elec(xelec,yelec,zelec,j);
0030 icount = icount+2*j+1;
0031 end;
0032
0033 if icount~= (nmax+1).^2
0034 error('Dope')
0035 end;
0036
0037 ls_mat = sp_mat*sp_mat';
0038
0039 if nargin == 6
0040 for i = 1:size(ls_mat,1)
0041 ls_mat(i,i) = ls_mat(i,i) + lambda;
0042 end;
0043 end;
0044
0045 lv_mat = sp_mat*v';
0046
0047 sp_coff = ls_mat\ lv_mat;
0048
0049 error = sp_mat'*sp_coff - v';
0050
0051 error_check(1) = sum(abs(error))/129;
0052
Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003