is it possible to add a 3D sphere marker to a 2D plot?
8 ビュー (過去 30 日間)
古いコメントを表示
is there an easy way to do this? would it be possible to use the sphere command? its part of a movie so don't know how feasible using the sphere command would be.
2 件のコメント
dpb
2018 年 8 月 7 日
sphere will create a 3D axis; you would have to somehow overlay it on the 2D one which would mean orienting it to only show the xy plane which reduces the appearance of the sphere to a circle since it's a projection onto the surface....
Adam
2018 年 8 月 7 日
The fact you have a 2D plot is largely irrelevant to plotting a sphere apart from the issue of getting it in the right place, it being visible and as dpb says, if it is only viewed in 2d then it is just a circle anyway.
You can plot anything you want together on a set of axes though if you use hold on to avoid replacing the other things on the axes.
When you plot an image it is still on a 3d axes, just with an X-Y projection. If you click the rotate icon on the toolbar you will soon end up with a 3d view where your image is just a plane through it.
回答 (1 件)
Star Strider
2018 年 8 月 7 日
Try this:
[Xs,Ys,Zs] = sphere;
figure
for k1 = 1:0.03:3.2
Xp = Xs + cos(k1*2*pi);
Yp = Ys + sin(k1*2*pi);
surf(Xp, Yp, Zs)
axis([-3 3 -3 3 -3 3])
% axis equal
view(0,90)
grid on
refreshdata
drawnow update
end
hold off
Experiment to get the result you want.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!