MATLAB中随机浮点数的运用

img

random round两个函数即可

img

你好,同学

a = rand(5,1)*(1e5-1e4)+1e4;%生成的五个随机数
disp(a) %显示生成的五个随机数
a = round(a,2);
fprintf('5%.2f\n',a)