参考:http://zhidao.baidu.com/link?url=3XZm35XpFf_kbADwDHEERtgFMKqHftiS5SyTCWcBtlF7B7zeNgoNqIzXxpJsHtBIGdofik99hN3-e_Gs9aYKSTbvgCbZ0Gp49hiUtP_L5hK% 设定p值p=0.6;% 产生随机矩阵m=3;n=4;A=rand(m,n);% 生成伯努利矩阵A=A<p; % for exampleA = 0.9572 0.1419 0.7922 0.0357 0.4854 0.4218 0.9595 0.8491 0.8003 0.9157 0.6557 0.9340 A = 0 1 0 1 1 1 0 0 0 0 0 0