I'm doing a project for orbital mechanics and I'm stuck on graphing a parabola using parametric equations. I think I know the what the problem is: I need it to graph the trajectory of the parabolic orbit, but I'm adding a value so large the function doesn't graph like a parabola should. Any help on how I can correctly graph this?
if true
% code
end
if
r_p=1.275620000225780e04;
a=-1.019309762925967e11;
Re=6.378e3;
q=-(r_p+a);
q2=q+a;
T=[-20000*pi,20000*pi];
x_graph=(-1*(T.^2))+q;
y_graph=T;
plot(x_graph,y_graph,'b');
hold on
hold on
grid on
plot(q,0,'ro') %center of the earth
plot(Re*cos(T)+q,Re*sin(T),'--') %plots the surface of the earth
hold on
% hold on
% lineseg([q 0], PeriVect_new)
% lineseg([q 0],PeriVect_OG)
% hold off
hold off
hold off
hold off
end

댓글 수: 3

Jan
Jan 2017년 10월 2일
You define 2 points also. How could this create a parabola?
Mike B
Mike B 2017년 10월 2일
What are you talking about? The point defined appears on the plot, it has nothing to do with the formation of the parabola.
Jan
Jan 2017년 10월 2일
편집: Jan 2017년 10월 2일
See my answer.

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

답변 (1개)

Jan
Jan 2017년 10월 2일
편집: Jan 2017년 10월 2일

1 개 추천

T is a [1 x 2] vector. Then x_graph and y_graph have 2 elements also. With these two points, you can either draw 2 points or a line, but not a parabola. See your code:
r_p = 1.275620000225780e04;
a = -1.019309762925967e11;
Re = 6.378e3;
q = -(r_p+a);
q2 = q + a;
T = [-20000*pi,20000*pi];
x_graph = (-1*(T.^2))+q;
y_graph = T;
disp(x_graph)
disp(y_graph)
Perhaps you want:
T = linspace(-20000*pi, 20000*pi, 1000);
x_graph = (-1*(T.^2))+q;
y_graph = T;
plot(x_graph,y_graph,'b');

카테고리

도움말 센터File Exchange에서 Geoscience에 대해 자세히 알아보기

질문:

2017년 10월 2일

편집:

Jan
2017년 10월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by