function [E,V,N,th,C,E0]=sdwcapt(TH,L,m,nth,vcut,grd) % [E,V,N,th,C,E0]=SDWCAPT(TH,L,m,nth,vcut,grd) % % Spherical harmonic localization to a spherical polar cap: % spatially concentrated and optimally bandlimited solutions. % % INPUT: % % TH Angular extent of the spherical cap, in degrees % L Bandwidth % m Angular order of the required data window, -lvcut & imag(V)==0); V=V(V>vcut & imag(V)==0); % But usually we "interpolate" them using the same kernel at the desired % values. E=(Kint*diag(w))*EGL*diag(1./V); % Make E start with a positive lobe for index=1:size(E,2) E(:,index)=E(:,index)*sign(E(2,index)); end % Verify automatic orthonormality over restricted interval % orv1=w(:)'*[EGL.^2]*(1+(m==0))*pi; % Calculate the latitudinal and longitudinal integral orv2=[EGL'*diag(w)*EGL]*(1+(m==0))*pi; disp(sprintf('Orthonormality: Mean absolute error %8.3e',... mean(mean(abs(orv2-diag(V)))))) % Output coefficients C E0=[E ; zeros(nth-size(E,1),size(E,2))]; if m==0 % These are normalized to the AREA of the unit sphere [C,rnk]=th2pl(E0,[],'im'); % Now they're normalized to unit area for the unit sphere C=C*sqrt(4*pi); else % Make it -2 today, August 11th, 2004 [C,rnk]=th2plm(E0,nth-2,m); C=[C ; repmat(NaN,1,size(C,2))]; end nlon=ceil(2*nth-1); % Output in degrees TH=TH*180/pi; th=thor; eval(sprintf('save %s E V L N TH C th nlon E0',fnpl)) end if grd==2 % Output on full grid if mor<=0 EE=E; clear E for index=1:size(EE,2) E{index}=EE(:,index)*cos(m*linspace(0,2*pi,nlon)); end end if mor>0 EE=E; clear E for index=1:size(EE,2) E{index}=EE(:,index)*sin(m*linspace(0,2*pi,nlon)); end end end