【发布时间】:2015-12-04 02:57:57
【问题描述】:
我想定义一个函数,它返回一个具有给定半径、中心和填充颜色的圆。我的函数现在只返回一个具有给定半径和中心的圆,但我不知道如何实现一个用任何给定颜色填充圆的变量。以下是圆的功能代码:
function h = circle(x,y,r)
hold on
th = 0:pi/100:2*pi;
xunit = r * cos(th) + x;
yunit = r * sin(th) + y;
h=plot(xunit,yunit)
hold off
我想我需要将 h=plot... 更改为 h=fill(xunit,yunit,'color') 但我不明白如何。有什么建议吗?
【问题讨论】:
标签: matlab