View Full Version : Plotting locations on Matlab 3D sphere

11-01-2013, 08:24 PM
Well, I've a 250x3 matrix containing some geographic coordinates locations, where the first column represents the latitude (-90 to 90), the second one longitude (-180 to 180), and the third one is just the radius (for now, I'm not considering altitude, so it's the same value for all).

I've tried creating a sphere, but I can't see how to plot the points on it. I've also just tried by plotting using sph2cart (for using this I made all latitudes and longitudes positive and running between 0 and 360) and then plot3. This option gives me a "sphere of points" with the correct radius, but wrong locations. Is possible to do this on Matlab?

The code looks like this:

superdat; % This is the 250x3 matrix of coordinates
[datacbo datacba datacz]=sph2cart(superdat(:,1)*(pi/180),superdat(:,2)*(pi/180),superdat(:,3));

Extra: a plot of the coordinates in 2D-Equirectangular projection


11-01-2013, 08:38 PM
Elevation is measured relative to one of the poles, not to the equator. You probably need to add a quarter turn to all your latitudes to get elevations.