sphere coordinates using latitude and longitude system
Show older comments
If I have a point coordinates A = (LatC, LonC, altC) where LatC, LonC, and altC are the latitude, longitude, and above ground level altitude of the point, how I can obtain the coordinates (Lat_i, Lon_i, alt_i) of the points on a sphere, whose center is point A and its radius is d (where d< altC), when I sweep horizontally and vertically at angles θ (say θ=1 deg) ?
For instance, the point A is the center of the sphere in the picture, and I want the position latitude and longitudes θ=1 deg relative to each other horizantally and vertically with the sphere radius being say d = 1 km.

Answers (1)
r = 1; % Radius 1 km
xo = 0; yo = 0; zo = 0; %Center, give points of A
m = 20;
n = 10;
theta=0:2*pi/m:2*pi ;
phi=-pi/2:pi/10:pi/2 ;
[T,P] = meshgrid(theta,phi) ;
X = xo + r *cos(P).* cos(T);
Y = yo + r *cos(P).* sin(T);
Z = zo + r *sin(P) ;
surf(X,Y,Z)
Or, you can use inbuilt function sphere.
[x,y,z] = sphere;
A = rand(1,3) ;
R = 1 ;
x = A(1)+x*R;
y = A(2)+y*R;
z = A(3)+z*R;
figure
surf(x,y,z)
Categories
Find more on Vector Data in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
