Home > matutils > angles > spaceangle_dither.m

spaceangle_dither

PURPOSE ^

[az,el]=spaceangle_dither(az,el,rms,units)

SYNOPSIS ^

function [az,el]=spaceangle_dither(az,el,rms,units)

DESCRIPTION ^

 [az,el]=spaceangle_dither(az,el,rms,units)

 Dither sperical polar coords az,el such that
 rms space angle has given value

 e.g.: obs.az=[45,60]; obs.el=[45,60];
       [dith.az,dith.el]=spaceangle_dither(obs.az,obs.el,0.1,'deg')
       rms(spaceangle(obs.az,obs.el,dith.az,dith.el,'deg'))

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [az,el]=spaceangle_dither(az,el,rms,units)
0002 % [az,el]=spaceangle_dither(az,el,rms,units)
0003 %
0004 % Dither sperical polar coords az,el such that
0005 % rms space angle has given value
0006 %
0007 % e.g.: obs.az=[45,60]; obs.el=[45,60];
0008 %       [dith.az,dith.el]=spaceangle_dither(obs.az,obs.el,0.1,'deg')
0009 %       rms(spaceangle(obs.az,obs.el,dith.az,dith.el,'deg'))
0010 
0011 if(~exist('units'))
0012   units='rad';
0013 end
0014 
0015 if(strcmp(units,'deg'))
0016   d2r=pi/180;
0017   az=az*d2r; el=el*d2r; rms=rms*d2r;
0018 end
0019 
0020 % choose 2 independent perp dither angles
0021 theta1=rms*randn(size(az))/sqrt(2);
0022 theta2=rms*randn(size(az))/sqrt(2);
0023 
0024 % rotate to genenate dither vector
0025 [xp,yp,zp]=rotaboutz(1,0,0,theta1);
0026 [xp,yp,zp]=rotabouty(xp,yp,zp,theta2);
0027 
0028 % rotate to center on desired points
0029 [xp,yp,zp]=rotabouty(xp,yp,zp,-el);
0030 [xp,yp,zp]=rotaboutz(xp,yp,zp,-az);
0031  
0032 % Convert back to spherical polar coords
0033 [az,el,r]=cart2sph(xp,yp,zp);
0034 
0035 % Prefer non negative az
0036 ind=az<0;
0037 az(ind)=az(ind)+2*pi;
0038 
0039 if(strcmp(units,'deg'))
0040   az=az/d2r; el=el/d2r;
0041 end
0042

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005