Matlab累积学习中遇到的函数

本文介绍了Matlab中用于生成连续均匀分布随机数的unifrnd函数及其用法,包括不同参数设置下的效果。此外,还列举了其他常见分布的随机数生成函数,如normrnd、binornd等,帮助理解Matlab中的随机数生成机制。
摘要由CSDN通过智能技术生成

1、产生连续均匀分布的随机数组——unifrnd

语法格式:
R = unifrnd(A,B)
R = unifrnd(A,B,m,n,…)
R = unifrnd(A,B,[m,n,…])

描述:
R = unifrnd(A,B) returns an array R of random numbers generated from the continuous uniform distributions with lower and upper endpoints specified by A and B, respectively. If A and B are arrays, R(i,j) is generated from the distribution specified by the corresponding elements of A and B. If either A or B is a scalar, it is expanded to the size of the other input.
解析:生成被A和B指定上下端点[A,B]的连续均匀分布的随机数组R。 如果A和B是数组,R(i,j)是生成的被A和B对应元素指定连续均匀分布的随数。 如果N或P是标量,则被扩展为和另一个输入有相同维数的数组。
R = unifrnd(A,B,m,n,…) or R = unifrnd(A,B,[m,n,…]) returns an m-by-n-by-… array. If A and B are scalars, all elements of R are generated from the same distribution. If either A or B is an array, they must be m-by-n-by-… .
解析:如果A和B是标量,R中所有元素是相同分布产生的随机数。 如果A或B是数组,则必须是m*n…数组。
A和B可以是向量也可以是标量。
(1)若两个都是向量,则两者都是列向量或都是行向量,而且维数相等,从A到B产生一系列区间,并且区间个数等于他们的维数。

 x = [1:9];
 y 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值