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

조회 수: 130 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2010년 4월 14일
편집: MathWorks Support Team 2024년 11월 13일
2次元上に円を描画する方法を教えてください。

채택된 답변

MathWorks Support Team
MathWorks Support Team 2024년 11월 13일
편집: MathWorks Support Team 2024년 11월 13일
関数としては提供されていませんが、円を構成する点を求め、それらを結ぶことで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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 離散データ プロット에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!