3D animate plot of satellite in orbit around Earth
58 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
chicken vector
il 23 Dic 2022
Commentato: leka0024
il 15 Dic 2023
Hello.
I am developing an app with app designer and I need to animate the plot of a satellite on a fixed orbit.
In the following, a simplified version of what I've always used:
C = imread('map.jpg');
[x, y, z] = ellipsoid(0,0,0, 6378.135, 6378.135,6356.750,1E2);
surf(x,y,z,circshift(flip(C),[0,ceil(size(C,2)/360)]), 'FaceColor', 'texturemap','EdgeColor','none');
axis equal;
hold on;
plot3(orbit(1,:),orbit(2,:),orbit(3,:),'linewidth',2,'color', .6*ones(1,3));
position = scatter3(orbit(1,1),orbit(2,1),orbit(3,1),'filled','color', 'r');
for j = 2 : size(position,2)
position.XData = orbit(1,j);
position.YData = orbit(2,j);
position.ZData = orbit(3,j);
pause(0.1);
end
uif = uifigure;
earth = geoglobe(uif);
hold(earth,'on');
geoplot3(earth,latitude,longitude,altitude,'linewidth',2,'color', .6*ones(1,3));
position = geoplot3(earth,latitude(1),longitude(1),altitude(3,1),'ro');
for j = 2 : length(altitude)
position.LatitudeData = latitude(j);
position.LongitudeData = longitude(j);
position.HeightData = altitude(j);
pause(0.1);
end
Unfortunately I faced two major problems:
- The Marker can't be set as 'filled' and I don't really like it this way
- The pause command doesn't work properly as the time elapsed between cycles is much larger
- The view of the globe is automatically updated and when the user tries to rotate the view with the figure tools, the values of campos are reset to a reference view automatically
The second problem can be fixed by setting campos before the loop.
The third problem is related to the automatic view update of geoglobe and I did not find a solution on how to disable it.
I am confident that disabling the automatic view update would also solve the second problem.
A side problem is the flickering transition given by the loop update, but I hope I can solve this with timer.
Is there a simple solution to these three problems that you might be aware of?
Are there any alternatives to obtain animated fancy plot like the second one?
Thanks
0 Commenti
Risposta accettata
Vidip Jain
il 20 Mar 2023
Regarding your first problem, the “geoplot3” function does not have an option to set the marker as filled. However, you can use the “scatter3” function instead of “geoplot3” to create filled markers on the globe.
Regarding your second problem, using the “pause” command in a loop can be problematic as the time elapsed between iterations may not be exactly the time specified in the “pause” command due to system timing and processing delays. Instead, you can use the “tic” and “toc” commands to measure the elapsed time between iterations and adjust for the processing time.
Regarding your third problem, the “geoglobe” function automatically updates the view when you plot data on the globe. One possible solution is to set the “XLim”, “YLim”, and “ZLim” properties of the axis to fixed values before plotting data on the globe. This will prevent the automatic view update from resetting the camera position.
2 Commenti
leka0024
il 15 Dic 2023
@Vidip Jain how can scatter3 be used with a geoglobe plot?
If I make a scatter3 and try to set its handle.Parent to be the GeographicGlobe handle, an error says that this is not allowed.
leka0024
il 15 Dic 2023
Also, why is geoglobe() only allowed to be in a uifigure?
I can do a gca(uif) and get a handle to the axes, with lots of properties, but I'm not sure that this is actually valid?
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Geographic Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!