Help Graphing a Parabola
Afficher commentaires plus anciens
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
Réponses (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');

Catégories
En savoir plus sur Geoscience dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!