フィルターのクリア

is it possible to add a 3D sphere marker to a 2D plot?

5 ビュー (過去 30 日間)
james Brown
james Brown 2018 年 8 月 7 日
回答済み: Star Strider 2018 年 8 月 7 日
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
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
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
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.

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by