matlab函数
1.
normpdf
格式:
Y = normpdf(X,mu,sigma)
含义:
2.
mvnrnd
从多元正态分布中产生随机数
格式:
r = mvnrnd(MU,SIGMA,cases)
产生cases个随机数,服从 均值mu,方差sigma的多元正态分布
3.
load fisheriris
load discrim
The sample data contains ratings of cities according to nine factors such as climate, housing, education, and health in the matrix ratings
.
matlab中的自带数据
4.
gscatter
格式:
gscatter(x,y,group)
gscatter(x,y,group,color
,sym
,size)
gscatter(x,y,group,c
olor
,sym
,size,doleg
)
load discrim
figure;
gscatter(ratings(:,1),ratings(:,2),group,'bg','*o')%ratings 包含于 discrim
xlabel('climate');
ylabel('housing');
结果:
5.
存入文件
fopen+fprintf
>> a=[17 24 1 8 15;23 5 7 14 16 ;4 6 13 20 22 ;10 12 19 21 3 ;11 18 25 2 9 ];
>> fid = fopen('b.txt','wt');
fprintf(fid,'%g\n',a); \n 换行
fclose(fid);
6.
unifrnd
随机生成数(组)
R = unifrnd(A,B,m,n,...)
or R = unifrnd(A,B,[m,n,...])返回 m*n阵列
unifrnd(0,5,2,3)
ans =
4.0736 0.6349 3.1618
4.5290 4.5669 0.4877
朝闻道