Borrar filtros
Borrar filtros

Plotting Trajectory in 3D From User Input

2 visualizaciones (últimos 30 días)
autumn
autumn el 16 de Ag. de 2019
Comentada: darova el 17 de Ag. de 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 comentario
darova
darova el 17 de Ag. de 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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by