資源簡介
用Matlab畫任意中心任意邊長的正六邊形,在這個六邊形內隨機撒點
代碼片段和文件信息
%%
theta?=?linspace(02*pi7);
D=2;?%邊長
X=1;??%中心橫坐標
Y=2;??%中心縱坐標
plot(D*cos(theta)+XD*sin(theta)?+?Y‘g-‘);
axis?square
i?=?0;
while?i?3
x?=?2*D*rand(12)-1*D;
if?(abs(x(1))?+?abs(x(2))/sqrt(3)?)?<=?D?&&?abs(x(2))?<=?D*sqrt(3)/2?
i?=?i+1;
hold?on
plot(x(1)?+?X?x(2)?+?Y‘r*‘);
end
end
hold?off
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????189952??2012-08-09?22:09??Matlab畫任意正六邊形原理說明.doc
?????文件???????2122??2012-08-10?07:44??result.fig
?????文件????????328??2012-08-10?07:57??liubianxing.m
-----------?---------??----------?-----??----
???????????????192402????????????????????3
- 上一篇:fcm_s matlab
- 下一篇:CT平行束濾波反投影重建程序
評論
共有 條評論