Plotting Right Ascension & Declination on Mercator Map
Show older comments
I'm developing a program to do many different satellite orbit calculations. One of them involves plotting the ground tracks of a given satellite on a mercator (lat & long) map. I have the Right Ascension and Declination angles in a vector called "rad" in the following code. With Right Ascension in the first column, and declination in the second column. The plot is coming out okay, except that it is connecting the groundtrack line when the right ascension (width) resets from 360 to 0. I can't quite figure out how to plot the data without connecting the line when the right ascension resets to 0 degrees from 360.
rad(:,1) ranges from 0 to 360 (right ascension) rad(:,2) ranges from -90 to 90 (declination)
earth = imread('ImageOfEARTH');
hold on
F = earth(end:-1:1,:,:);
image([0 360],[-90 90],F)
plot(rad(:,1),rad(:,2),'red');
axis([0,360,-90,90])
daspect([1 1 1]);
This code outputs the following plot:

See how that line is connected through the middle? I need to eliminate that.
Thanks!
-Brandon
Accepted Answer
More Answers (1)
Chad Greene
on 30 Nov 2015
As Star Strider mentioned, you can add a NaN where it wraps around. A faster and possibly less visually appealing way is to plot red dots instead of a red line:
plot(rad(:,1),rad(:,2),'r.');
A note unrelated to your question: Your map isn't actually a Mercator map. It's simply unprojected geographic coordinates where you've given all degrees longitude and latitude equal size. Mercator projections make Greenland appear larger than Africa.
Categories
Find more on Reference Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!