# 一些matlab程序的实现

---------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------

alpha=0:pi/20:2*pi; %角度[0,2*pi]

R=2; %半径

x=R*cos(alpha);

y=R*sin(alpha);

plot(x,y,'-')

axis equal

fill(x,y,'r'); %用红色填充

--------------------------------------------------------------------------------------------------

function [s] = eg_sum( n )

% calculate the sum of 1..n

s = 0;

for i = 1:n

s = s + i;

end

---------------------------------------------------------------------------------------------------

fill 函数代表不同颜色的标示符一共有八种： 标记符 颜色 r 红 g 绿 b 蓝 c 蓝绿 m 紫红 y 黄 k 黑 w 白

---------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------

x=[7,9,11,13,15,17,18,20]; y=[20,6,14,4,18,14,2,14];

clf; x=[7,9,11,13,15,17,18,20]; y=[20,6,14,4,18,14,2,14]; voronoi(x,y)

267 篇文章43 人订阅

0 条评论