Plotting Trajectory in 3D From User Input

2 vues (au cours des 30 derniers jours)
autumn
autumn le 16 Août 2019
Commenté : darova le 17 Août 2019
Hi! I'm trying to plot a trajectory on a globe (that I have already built) using an input window. The code for that is below.
prompt = {'Enter start x-coordinate (ECF).',...
'Enter start y-coordinate (ECF).',...
'Enter start z-coordinate (ECF).',...
'Enter end x-coordinate (ECF).',...
'Enter end y-coordinate (ECF).',...
'Enter end z-coordinate (ECF).'};
dlgtitle = 'Custom Trajectory';
dims = [1 35];
definput = {'4.89e6','-4.27e4','4.08e6',...
'5.11e6','1.53e6','4.69e6'};
answer = inputdlg(prompt,dlgtitle,dims,definput);
As you can see, there are values for the starting point and ending point that the user can input. Of course, I want the entire trajectory. Is there any way to increment between the starting and ending points and plot them from a window like this? I hope I explained this well enough. Thank you!
  1 commentaire
darova
darova le 17 Août 2019
What if point are not on the sphere?
S = str2double(answer(1:3));
E = str2double(answer(4:6));
[X,Y,Z]= sphere();
R = norm(S);
surf(R*X,R*Y,R*Z,'EdgeColor','none')
hold on
plot3([S(1) E(1)], [S(2) E(2)], [S(3) E(3)],'.-b')
hold off
axis equal
img111.png

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by