[tp,vtp] = xyz2tp(x,y,z,v)
0001 function [tp,vtp] = xyz2tp(x,y,z,v) 0002 %[tp,vtp] = xyz2tp(x,y,z,v) 0003 tp = zeros(size(x,2)*size(x,1),2); 0004 vtp = zeros(size(x,2)*size(x,1),1); 0005 [az,el,r] = cart2sph(x,y,z); 0006 el2 = pi/2*ones(size(el)) - el; 0007 ic = 1; 0008 for i = 1:size(az,1) 0009 for j = 1:size(az,2) 0010 tp(ic,1) = el2(i,j); 0011 tp(ic,2) = az(i,j); 0012 ic = ic+1; 0013 if nargin == 4 0014 vtp(ic) = v(i,j); 0015 end 0016 end 0017 end