Plotting Trajectory in 3D From User Input

1 回表示 (過去 30 日間)
autumn
autumn 2019 年 8 月 16 日
コメント済み: darova 2019 年 8 月 17 日
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 件のコメント
darova
darova 2019 年 8 月 17 日
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

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by