I've created this function:
function [] = GroundTrack(VettXs, VettYs, VettZs, omegarot, dt, Nt)alphadate = evalin('base', 'alphadate');figure('position', [25 200 800 500])M = imread('Earth texture.jpg');S = imread('Satellite icon.png');imagesc([-180 180], [-90 90], M); daspect([1 1 1]); hold onxlabel('Longitude [deg]');ylabel('Latitude [deg]'); title('Satellite ground track');% Supponendo che il satellite venga sempre lanciato dalla longitudine per
% cui passa l'asse X dell'IRF la prima posizione del satellite dipenderà
% dalla data del lancio selezionata dall'utente.
[longitudei,latitudei, altitudei] = cart2sph(VettXs(2),VettYs(2),VettZs(2));plot((longitudei + alphadate)*180/pi, latitudei*180/pi, 'g.', ... 'markersize', 16); hold onI = imshow(S, 'XData', [longitudei*180/pi - 3 longitudei*180/pi + 3], ... 'YData', [latitudei*180/pi - 3 latitudei*180/pi + 3]);for i = 3 : Nt-1 [longitude,latitude, altitude] = cart2sph(VettXs(i),VettYs(i),VettZs(i)); beta = omegarot*dt*i; a = longitude - beta + alphadate; n = a/(2*pi); if (n - floor(n)) <= 0.5 a = 2*pi*(n - floor(n));else a = -2*pi*(1 - (n - floor(n)));endplot(a*180/pi, latitude*180/pi, 'r.'); hold ondelete(I);I = imshow(S, 'XData', [a*180/pi - 3 a*180/pi + 3], 'YData',... [latitude*180/pi - 3 latitude*180/pi + 3]); drawnowend[longitudef,latitudef, altitudef] = cart2sph(VettXs(Nt),VettYs(Nt),VettZs(Nt));gamma = longitudef - omegarot*dt*Nt + alphadate; n = gamma/(2*pi); if (n - floor(n)) <= 0.5 gamma = 2*pi*(n - floor(n));else gamma = -2*pi*(1 - (n - floor(n)));endplot(gamma*180/pi, latitudef*180/pi, 'y.',... 'markersize', 16);end
After I put the object "I" (therefore "S" too) in the function, the axis of the figure's plot indicating latitude and longitude disappeared for some reason (only the labels remain but the axis are gone). I've already tried putting imshow before plot in the for cycle but the axis still don't appear. Why does this happen, and how can I bring them back?
Best Answer