How do I plot a circle with a given radius and center and i need to extract x,y,z points

18 ビュー (過去 30 日間)
i know to extract x,y using
th = 0:pi/50:2*pi;
xunit = r * cos(th) + x;
yunit = r * sin(th) + y;
but how will i get z co-ordinate if i need to plot one 3d circle.

採用された回答

Star Strider
Star Strider 2015 年 11 月 8 日
The circle you described is two-dimensional. The ‘z’ coordinate is uniformly 0. If you want a circle above the plane, just define a new variable ‘zunit’ and define a vector to define it. This code puts the circle at z=5:
r = 1.25;
x = 0.1;
y = -0.1;
th = 0:pi/50:2*pi;
xunit = r * cos(th) + x;
yunit = r * sin(th) + y;
zunit = 5*ones(size(th));
figure(1)
plot3(xunit, yunit, zunit)
grid on
axis([-1.5 1.5 -1.5 1.5 0 10])
  1 件のコメント
Rudranarayan Kandi
Rudranarayan Kandi 2018 年 9 月 11 日
Very nice!!! Can you plot a 3D circle on a triangular plane with x,y and z intercepts ??? radius and centre of the circle is known. Please help

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

その他の回答 (1 件)

rajath mavathur basavaraj
rajath mavathur basavaraj 2015 年 11 月 8 日
thank you very much it really helped me to understand the working of xyz plane.
  1 件のコメント
Star Strider
Star Strider 2015 年 11 月 8 日
My pleasure.
If you want to incline the circle (instead of having it flat), use this for ‘zunit’:
zunit = 2.5 + 2.5*sin(th-pi); % Inclined Circle
Experiment with it, and with various other functions in ‘zunit’, and observe the effects. The only constraint is that they all have to be the same size as (or functions of) your ‘th’ variable.

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

カテゴリ

Help Center および File Exchange2-D Function Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by