フィルターのクリア

sector of a circle

1 回表示 (過去 30 日間)
david
david 2013 年 7 月 16 日
i would like to write a function which draws a sector of a circle. the input argument being; the center of the circle , the sector angle and radiud. Any help ?

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 7 月 16 日
編集済み: Azzi Abdelmalek 2013 年 7 月 16 日
x0=2;
y0=3;
r=10; % radius
angl=3*pi/4;
angl=rem(angl,2*pi);
if angl<=pi
x=r*cos(angl):0.01:r+x0;
y1=sqrt((r^2-(x-x0).^2))+y0;
plot(x,y1)
else
x=-r:0.01:r+x0;
y1=sqrt((r^2-(x-x0).^2))+y0;
plot(x,y1);
hold on
x2=-r:0.01:-r*cos(angl-pi)+x0;
y2=-sqrt((r^2-(x2-x0).^2))+y0;
plot(x2,y2);
end
xlim([x0-r x0+r])
ylim([y0-r,y0+r])
axis square

David Sanchez
David Sanchez 2013 年 7 月 16 日
sector_end = your_value_here;
r = radious;
t=0:.01:sector_end;
x=r*cos(t);
y=r*sin(t);

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by