0001 function oned_array = oned_pos(good_chan,xelec,yelec,zelec,radius,calc_type) 0002 0003 [az,el,r] = cart2sph(xelec,yelec,zelec); 0004 0005 el = pi*ones(size(el,1),size(el,2))/2 - el; 0006 0007 if calc_type == 's' 0008 0009 oned_array = az(good_chan) - az(good_chan(1))*ones(size(good_chan,1),size(good_chan,2)); 0010 0011 elseif calc_type == 'g' 0012 0013 zeroptaz = az(good_chan(1))*ones(size(good_chan,1),size(good_chan,2)); 0014 zeroptel = el(good_chan(1))*ones(size(good_chan,1),size(good_chan,2)); 0015 0016 azgood = az(good_chan); 0017 elgood = el(good_chan); 0018 0019 abgdist = acos(cos(elgood).*cos(zeroptel)+sin(elgood).*sin(zeroptel).*cos(azgood - zeroptaz)); 0020 0021 abgdist = abgdist*radius; 0022 0023 else 0024 0025 error('unknown array type'); 0026 0027 end; 0028 0029 0030 0031 0032