2次元上に円を描画し​たいのですが、どのよ​うにすればよいですか​?

30 vues (au cours des 30 derniers jours)
MathWorks Support Team
MathWorks Support Team le 14 Avr 2010
2次元上に円を描画する方法を教えてください。

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 13 Nov 2024
Modifié(e) : MathWorks Support Team le 13 Nov 2024
関数としては提供されていませんが、円を構成する点を求め、それらを結ぶことで2次元上に円を描画することができます。
% 等間隔ベクトルの作成 t = linspace(0,2*pi,100); figure plot(sin(t),cos(t)) axis([-2,2,-2,2]) axis square
また、円の中心や半径を指定することもできます。
figure cx = 1; cy = 1; % 中心 r = 0.5; % 半径 plot(r*sin(t)+cx,r*cos(t)+cy) axis([-2,2,-2,2]) axis square
その他に、patch関数やcylinder関数を使用しても描画することができます。
% patchを使う方法 figure patch(sin(t),cos(t),'k') axis([-2,2,-2,2]) axis square % cylinderを使う方法 figure [x,y,z] = cylinder(1,100); z(:) = 0; % 高さデータを0に設定 surf(x,y,z) view(2) axis([-2,2,-2,2]) axis square grid off

Plus de réponses (0)

Tags

Produits

Community Treasure Hunt

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

Start Hunting!