How do I animate a 3d plot of a satellite orbit given its' orbital parameters.

4 ビュー (過去 30 日間)
E. Miguel Reiner Santos
E. Miguel Reiner Santos 2020 年 10 月 25 日
回答済み: Matteo Marzorati 2021 年 12 月 8 日
The plot function that made is the following:
function plotOrbit(a, e, i, OM, om, mu)
% a, e, i, OM, om are the orbital parameters
% mu = 3.986*10^5 (Earth's gravitational parameter)
r_vect = [];
v_vect = [];
for th = 0: 0.01: (2*pi + 0.01)
% par2car is an .m file that uses the orbital parameters to obtain
% the position and velocity vectors.
[rr, vv] = par2car(a, e, i, OM, om, th, mu);
r_vect = [r_vect; rr'];
end
plot3(r_vect(:, 1), r_vect(:, 2), r_vect(:, 3))
end
I would like to have a moving point along the orbit which varies it's velocity over time.
  1 件のコメント
Henrique Chaves
Henrique Chaves 2021 年 10 月 19 日
@E. Miguel Reiner Santos Sorry for bother you, but i want to make something similiar to you.
Can you make available your code please?
Thanks !

サインインしてコメントする。

回答 (2 件)

Srivardhan Gadila
Srivardhan Gadila 2020 年 10 月 28 日
You can refer to the documentation of plot3, pause, Specify Axis Limits, hold & figure.
The following is the example code based on the above functions:
1. If you want the point moving i.e., new point to appear and previous point to disappear:
figure
for i = 1:10
plot3(i,abs(sqrt(100-i^2)),5,'o');
xlim([0 10])
ylim([0 10])
zlim([0 10])
% hold on
pause(1)
end
% hold off
2. If you want all the previous points to appear in the plot as well:
figure
for i = 1:10
plot3(i,abs(sqrt(100-i^2)),5,'o');
xlim([0 10])
ylim([0 10])
zlim([0 10])
hold on
pause(1)
end
hold off

Matteo Marzorati
Matteo Marzorati 2021 年 12 月 8 日
you can use Matlab function comet3(X,Y,Z), where the 3 inputs are the vectors that define the orbit

カテゴリ

Help Center および File ExchangeSatellite and Orbital Mechanics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by