Generate evenly distributed coordinates
1 次查看(过去 30 天)
显示 更早的评论
How can I generate coordinates which are all separated by the same distance? Thanks for your help.
0 个评论
采纳的回答
更多回答(1 个)
Azzi Abdelmalek
2013-8-24
编辑:Azzi Abdelmalek
2013-8-24
Edit
n=10
distance=4;
x1=0:distance:(n-1)*distance;
x2=distance/2:distance:n*distance-distance/2;
distancev=distance*sin(pi/3);
y1=0:distancev*2:(n-1)*distancev;
y2=distancev:2*distancev:n*distancev;
a1=repmat(x1,n/2,1);
a2=repmat(y1',1,n);
b1=repmat(x2,n/2,1);
b2=repmat(y2',1,n);
x=[a1(:);b1(:)];
y=[a2(:);b2(:)]
scatter(x,y)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!