www.gusucode.com > map 案例源码 matlab代码程序 > map/CalculateTrackAndDisplayItOnMapExample.m
%% Calculate Track and Display It on Map % The track function is useful for generating data in % order to display tracks. Lieutenant Sextant is the navigator of the USS % Neversail. He is charged with plotting a track to take Neversail from the % Straits of Gibraltar to Port Said, Egypt, the northern end of the Suez % Canal. He has picked appropriate waypoints and now would like to display % the track for his captain's approval. %% % First, display a chart of the Mediterranean Sea. load coastlines axesm('mercator','MapLatLimit',[28 47],'MapLonLimit',[-10 37],... 'Grid','on','Frame','on','MeridianLabel','on','ParallelLabel','on') geoshow(coastlat,coastlon,'DisplayType','line','color','b') %% % These are the waypoints Lt. Sextant has selected. waypoints = [36,-5; 36,-2; 38,5; 38,11; 35,13; 33,30; 31.5,32]; %% % Now display the track. With a display this clear, the captain gladly % approves the plan. [lttrk,lntrk] = track('rh',waypoints,'degrees'); geoshow(lttrk,lntrk,'DisplayType','line','color','r')