i=1; R2=1; sphere(25); colormap([1,1,1]); hold on daspect([1 1 1]) %streches the sphere axis equal; xlabel('x-axis') ylabel('y-axis') zlabel('z-axis') rotate3d on while i<=30 %theta= acosd(1.-2.*rand()); %uniform theta %Phi= 2.*180.*rand(); % uniform phi theta= acosd(1.-2.*i/30); %uniform theta Phi= 0.5; % uniform phi x1= R2*sin(theta)*cos(Phi); % measured in the source coordinate y1= R2*sin(theta)*sin(Phi); %measured in the source coordinate z1= R2*cos(theta); i=i+1; plot3(x1,y1,z1,'.'); hold on end