how to paint a circle?

2 views (last 30 days)
Ana Beatriz Baptista
Ana Beatriz Baptista on 17 Dec 2020
Answered: Star Strider on 17 Dec 2020
It's possible I draw a circle and then paint it all not only the line?
Imagine I do that:
x1=@(x) 6+sqrt(2-(x-1.5)^2);
x2=@(x) 6-sqrt(2-(x-1.5)^2);
hold on
fplot(x1, [0 15])
fplot(x2,[0 15])
axis equal
axis equal off
hold off
How can I paint inside of the circle?

Accepted Answer

Star Strider
Star Strider on 17 Dec 2020
Try this:
x1=@(x) 6+sqrt(2-(x-1.5)^2);
x2=@(x) 6-sqrt(2-(x-1.5)^2);
hold on
v1 = fplot(x1, [0 15]);
v2 = fplot(x2,[0 15]);
fill([v1.XData v2.XData], [v1.YData v2.YData], 'g', 'EdgeColor','g') % Fill The Circle
axis equal
axis equal off
hold off
producing:
Note that fplot is not the best option for this, so ther is a small gap.

More Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!