I want to create an array of 3-coordinate points (azimuth, elevation and R) in the shape of a sphere (to get and Earth grid), but am currently struggling. I've been trying with both sph2cart and just the sphere function but can't figure out how to get my X,Y,Z (or az,el,R) data for each point. Currently I've been trying;
res = 20;
R = 100;
LDA = -pi:2*pi/res:pi;
PHI = -pi/2:pi/res:pi/2;
for ii = 1:length(LDA)^2
for jj = 1:length(LDA)
for kk = 1:length(PHI)
point(ii,:) = [LDA(jj) PHI(kk) R];
end
end
end
I'm aware this doesn't work because it just overwrites every time the loop number changes, but it helps illustrate that I want my points in an array with 3 collumns for comparing to other points that I'll have later. Is there a better way to do this?