Ploting satellite's orbit

조회 수: 7 (최근 30일)
endrius ndreks
endrius ndreks 2021년 5월 31일
댓글: Star Strider 2021년 6월 1일
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)

채택된 답변

Star Strider
Star Strider 2021년 5월 31일
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
endrius ndreks
endrius ndreks 2021년 6월 1일
It worked, thanks.
I had been trying for a week
Star Strider
Star Strider 2021년 6월 1일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile 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