>> n=500; %散点的个数
>> R=5; %圆的半径
>> Seta=0:0.01:2*pi;
>> X=R.*cos(Seta);
>> Y=R.*sin(Seta);
>> plot(X,Y) %画出圆
>> axis square
>> r=R*rand(1,n);
>> seta=2*pi*rand(1,n);
>> x=r.*sin(seta);
>> y=r.*cos(seta);
>> hold on
>> plot(x,y,'r*')
========第二种=========
n=500; %散点数
R=5;
t=0:0.02:2*pi;
plot(R*cos(t),R*sin(t),'r');
axis square
hold on
r=R*sqrt(rand(1,n));
seta=2*pi*rand(1,n);
x=r.*cos(seta);
y=r.*sin(seta);
plot(x,y,'*')
第二种是比较均匀的。
将 Matlab 中的矩阵写入 txt 文件的方法 转自
http://hi.baidu.com/icebergcao
2008-11-07 22:37
将 Matlab 中的矩阵写入 txt 文件的方法