I'm currently doing an exercise about orbit propagator. From initials distance from earth and velocity (r0 and v0) i should plot orbit considering a single day and sampling every 5 minute.
When i plot i can see that calculated elements are right, because of extreme values in graphic, but i can't see any line on it, just blank. Can someone find where's the problem? I also tried with a cycle "for t=0:300:86400" and ploting inside the cycle and got the same blank page
clear
close all
clc
t0=0;
[a, e, i, OmegaG, omegap, Nu] = rv2COE(r0,v0);
COE = [a, e, i, OmegaG, omegap, Nu];
E0=2*(atan(tan(Nu/2)/(sqrt((1+e)/(1-e)))));
M0=E0 - e*sin(E0);
t=0:300:86400
Mf = ((t-t0)/sqrt(a^3/Mu))+M0; %using newton to find true anomaly Nut in every time frame
Efiniziale = Mf; %
Ef = Iterazione(Efiniziale,e,Mf); %
Nut=2*atan(tan(Ef/2)*sqrt((1+e)/(1-e))); %
r1 = ((a*(1-e^2))/(1+e*cos(Nut)));
ROmegaG=[cos(OmegaG) -sin(OmegaG) 0; sin(OmegaG) cos(OmegaG) 0; 0 0 1];
Ri=[1 0 0; 0 cos(i) -sin(i); 0 sin(i) cos(i)];
Romegap=[cos(omegap) -sin(omegap) 0; sin(omegap) cos(omegap) 0; 0 0 1];
Rtot=ROmegaG*Ri*Romegap; % global rotation matrix
r1vector=Rtot*[r1*cos(Nut), r1*sin(Nut), 0]';
v1vector=Rtot*[-(Mu*sin(Nut))/H, (Mu*(e+cos(Nut)))/H, 0]';
x=r1vector(1);
y=r1vector(2);
z=r1vector(3);
figure(1)
hold on
plot3(x,y,z,'b')
view(135,45)

 采纳的回答

It is not possible to run the code because several constants and at least one function are missing.
Try either:
plot3(x,y,z,'.b')
or:
scatter3(x,y,z,'b','filled')
and see if the plot now appears.

2 个评论

It worked, thanks.
I had been trying for a week
As always, my pleasure!

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Satellite and Orbital Mechanics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by