フィルターのクリア

How to plot a semi-circle on the horizontal axis in MATLABs & How to shade half the cirlce?

13 ビュー (過去 30 日間)
Ahmed
Ahmed 2022 年 12 月 3 日
回答済み: Voss 2022 年 12 月 5 日
Hello I recetly got into plotting on MATLABs and I was wondering how I could create a semi-circle on the x-axis, and shade half of the semi-cicle afterwards.

回答 (2 件)

Image Analyst
Image Analyst 2022 年 12 月 3 日

Voss
Voss 2022 年 12 月 5 日
Npts = 101;
r = 2;
c = [0 0];
theta = linspace(0,pi,Npts);
x = c(1) + r.*cos(theta);
y = c(2) + r.*sin(theta);
fill([x(1:(Npts+1)/2) c(1) x(1)], ...
[y(1:(Npts+1)/2) c(2) y(1)], ...
'y', ...
'EdgeColor','none')
hold on
plot([x x(1)],[y y(1)],'k','LineWidth',2)
axis equal

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by