Home > mfiles > plotSats.m

plotSats

PURPOSE ^

Plot the Earth and GPS satellites as spheres in 3D space

SYNOPSIS ^

function plotSats( sats )

DESCRIPTION ^

 Plot the Earth and GPS satellites as spheres in 3D space
 INPUT: an array of structs representing the satellites

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Plot the Earth and GPS satellites as spheres in 3D space
0002 % INPUT: an array of structs representing the satellites
0003 function plotSats( sats )
0004     figure(100);
0005     %% BEGIN draw Earth
0006     axesm('globe','Grid','on'); % draw a sphere
0007     view(60,60); % adjust the camera angle
0008     load coast; % load the costline mat file
0009     plotm(lat,long); % plot the lat, long of the coastline
0010     load topo; % load the topo mat file
0011     meshm(topo,topolegend); % overlay the topo on the Earth
0012     % END draw Earth
0013     r = 0.25;
0014     [X Y Z] = sphere(20); hold on; % create a sphere at the origin
0015     for i = 1:length(sats),
0016         % now draw the sphere, but offset from the origin using the
0017         % satellite position (scaled)
0018         surf(...
0019             r*(X+sats(i).x/1000), ...
0020             r*(Y+sats(i).y/1000), ...
0021             r*(Z+sats(i).z/1000)); 
0022         hold on;
0023     end
0024     % make the background white
0025     set(gcf,'color','white');
0026     % now set all the axis to be the same
0027     % this step is IMPORTANT!
0028     axis equal;
0029     % axis off;
0030     hold off;
0031 end

Generated on Sat 22-Feb-2014 01:14:24 by m2html © 2005