没有合适的资源?快使用搜索试试~ 我知道了~
(完整版)Matlab各种随机数设置.pdf
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 78 浏览量
2023-11-07
22:14:03
上传
评论
收藏 305KB PDF 举报
温馨提示
试读
10页
(完整版)Matlab各种随机数设置.pdf
资源推荐
资源详情
资源评论
Matlab 各种随机数设置
randn (伪随机正态分布数)
Normally distributed pseudorandom numbers Syntax r = randn(n) randn(m,n) randn([m,n])
randn(m,n,p,...) randn([m,n,p,...]) randn(size(A)) r = randn(..., 'double') r = randn(..., 'single')
Description
r = randn(n) returns an n -by-n matrix containing pseudorandom values drawn from the standard
normal distribution. randn(m,n) or randn([m,n]) returns an m-by-n matrix. randn(m,n,p,...) or
randn([m,n,p,...]) returns an m-by-n-by-p-by-... array. randn returns a scalar. randn(size(A)) returns an
array the same size as A.
r = randn(..., 'double') or r = randn(..., 'single') returns an array of normal values of the specified class.
Note The size inputs m, n, p, ... should be nonnegative integers. Negative integers are treated as 0.
The sequence of numbers produced by randn is determined by the internal state of the uniform
pseudorandom number generator that underlies rand, randi, and randn. randn uses one or more
uniform values from that default stream to generate each normal value. Control the default stream
using its properties and methods.
Note In versions of MATLAB prior to 7.7 (R2008b), you controlled the internal state of the random
number stream used by randn by calling randn directly with the 'seed' or 'state' keywords.
Examples
Generate values from a normal distribution with mean 1 and standard deviation 2. r = 1 +
2.*randn(100,1);
Generate values from a bivariate normal distribution with specified mean vector and covariance
matrix.
mu = [1 2];
Sigma = [1 .5; .5 2]; R = chol(Sigma); z = repmat(mu,100,1) + randn(100,2)*R;
Replace the default stream at MATLAB startup, using a stream whose seed is based on clock,
so that randn will return different values in different MATLAB sessions. It is usually not desirable to do
this more than once per MATLAB session.
RandStream.setDefaultStream ...
(RandStream('mt19937ar','seed',sum(100*clock)));
randn(1,5)
Save the current state of the default stream, generate 5 values, restore the state, and repeat the
sequence.
defaultStream = RandStream.getDefaultStream; savedState = defaultStream.State;
z1 = randn(1,5) defaultStream.State = savedState;
z2 = randn(1,5) % contains exactly the same values as z1
Normrnd (随机正态分布数)
Normal random numbers
资源评论
a66889999
- 粉丝: 38
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- rdf0412-kcu116-pcie-c-2019-1.zip(XILINX KCU116 源码)
- 基于C#语言的winform界面火车票订票系统(源码+实验报告)
- 【华为OD部分真题及讲解】华为OD部分真题及讲解
- 基于Python+Django的京东商品比价系统源码+全部资料(毕业设计).zip
- G460 G560 Z460 Z560的最新BIOS 2.18版(无白名单)
- MetaJUI v0.4
- 基于Python+Django的京东商品比价系统源码+全部资料(毕业设计).zip
- linux常用命令大全
- 立体相机标定-使用OpenCV+Cpp对立体相机进行标定-calibration-附项目源码+流程教程-优质项目实战.zip
- 基于SpringBoot+Mysql开发的酒店管理系统
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功