-
大小: 159KB文件類型: .rar金幣: 1下載: 0 次發(fā)布日期: 2021-01-10
- 語言: Matlab
- 標(biāo)簽: matlab??正六邊形??隨機(jī)撒點(diǎn)??
資源簡介
用Matlab畫任意中心任意邊長的正六邊形,在這個(gè)六邊形內(nèi)隨機(jī)撒點(diǎn)
代碼片段和文件信息
%%
theta?=?linspace(02*pi7);
D=2;?%邊長
X=1;??%中心橫坐標(biāo)
Y=2;??%中心縱坐標(biāo)
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
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????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平行束濾波反投影重建程序
評論
共有 條評論