ImageVerifierCode 换一换
格式:DOCX , 页数:10 ,大小:118.39KB ,
资源ID:7424806      下载积分:10 金币
快捷注册下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/7424806.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请

   平台协调中心        【在线客服】        免费申请共赢上传

权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

注意事项

本文(Matlab 各种随机数设置.docx)为本站上传会员【pc****0】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

Matlab 各种随机数设置.docx

1、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 pseud

2、orandom 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 = r

3、andn(..., '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

4、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

5、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

6、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 d

7、esirable 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.getD

8、efaultStream; 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 Syntax R = normrnd(mu,sigma) R = normrnd(mu,sigma,m,n,...) R = normrnd(mu,sigma,[m,n,...])

9、 Description R = normrnd(mu,sigma) generates random numbers from the normal distribution with mean parameter mu and standard deviation parameter sigma. mu and sigma can be vectors, matrices, or multidimensional arrays that have the same size, which is also the size of R. A scalar input for mu or

10、 sigma is expanded to a constant array with the same dimensions as the other input. R = normrnd(mu,sigma,m,n,...) or R = normrnd(mu,sigma,[m,n,...]) generates an m-by-n-by-... array. The mu, sigma parameters can each be scalars or arrays of the same size as R. Examples n1 = normrnd(1:6,1./(1:6)

11、) n1 = 2.1650 2.3134 3.0250 4.0879 4.8607 6.2827 n2 = normrnd(0,1,[1 5]) n2 = 0.0591 1.7971 0.2641 0.8717 -1.4462 n3 = normrnd([1 2 3;4 5 6],0.1,2,3) n3 = 0.9299 1.9361 2.9640 4.1246 5.0577 5.9864 randperm (RandStream) (区域内的所有整数的随机分布) Random permutation randperm(

12、s,n) Description randperm(s,n) generates a random permutation of the integers from 1 to n. For example, randperm(s,6) might be [2 4 5 6 1 3]. randperm(s,n) uses random values drawn from the random number stream s. betarnd (贝塔分布) 贝塔分布是一个作为伯努利分布和二项式分布的共轭先验分布的密度函数 Syntax R = betarnd(A,B)

13、R = betarnd(A,B,m,n,...) R = betarnd(A,B,[m,n,...]) Description R = betarnd(A,B) generates random numbers from the beta distribution with parameters specified by A and B. A and B can be vectors, matrices, or multidimensional arrays that have the same size, which is also the size of R. A scalar

14、input for A or B is expanded to a constant array with the same dimensions as the other input. R = betarnd(A,B,m,n,...) or R = betarnd(A,B,[m,n,...]) generates an m-by-n-by-... array containing random numbers from the beta distribution with parameters A and B. A and B can each be scalars or arrays

15、 of the same size as R. Examples a = [1 1;2 2]; b = [1 2;1 2]; r = betarnd(a,b) r = 0.6987 0.6139 0.9102 0.8067 r = betarnd(10,10,[1 5]) r = 0.5974 0.4777 0.5538 0.5465 0.6327 r = betarnd(4,2,2,3) r = 0.3943 0.6101 0.5768 0.5990 0.2760 0.5474 Binornd (二项式分布)

16、 二项分布(binomial distribution)就是对这类只具有两种互斥结果的离散型随机事件的规律性进行描述的一种概率分布。 Syntax R = binornd(N,P) R = binornd(N,P,m,n,...) R = binornd(N,P,[m,n,...]) Description R = binornd(N,P) generates random numbers from the binomial distribution with parameters specified by the number of trials, N, and probab

17、ility of success for each trial, P. N and P can be vectors, matrices, or multidimensional arrays that have the same size, which is also the size of R. A scalar input for N or P is expanded to a constant array with the same dimensions as the other input. R = binornd(N,P,m,n,...) or R = binornd(N,P

18、[m,n,...]) generates an m-by-n-by-... array containing random numbers from the binomial distribution with parameters N and P. N and P can each be scalars or arrays of the same size as R. Algorithm The binornd function uses the direct method using the definition of the binomial distribution as a

19、 sum of Bernoulli random variables. Examples n = 10:10:60; r1 = binornd(n,1./n) r1 = 2 1 0 1 1 2 r2 = binornd(n,1./n,[1 6]) r2 = 0 1 2 1 3 1 r3 = binornd(n,1./n,1,6) r3 = 0 1 1 1 0 3 chi2rnd (卡方分布) 若n个相互独立的随机变量ξ₁、ξ₂、……、ξn ,均服从标准正态分布,则这n个服

20、从标准正态分布的随机变量的平方和构成一新的随机变量,其分布规律称为χ²分布 Syntax R = chi2rnd(V) R = chi2rnd(V,m,n,...) R = chi2rnd(V,[m,n,...]) Description R = chi2rnd(V) generates random numbers from the chi-square distribution with degrees of freedom parameters specified by V. V can be a vector, a matrix, or a multidimensi

21、onal array. R is the same size as V. R = chi2rnd(V,m,n,...) or R = chi2rnd(V,[m,n,...]) generates an m-by-n-by-... array containing random numbers from the chi-square distribution with degrees of freedom parameter V. V can be a scalar or an array of the same size as R. Examples Note that the

22、first and third commands are the same, but are different from the second command. r = chi2rnd(1:6) r = 0.0037 3.0377 7.8142 0.9021 3.2019 9.0729 r = chi2rnd(6,[1 6]) r = 6.5249 2.6226 12.2497 3.0388 6.3133 5.0388 r = chi2rnd(1:6,1,6) r = 0.7638 6.0955 0.8273 3.250

23、6 1.5469 10.9197 Copularnd (连接函数分布) Copula函数描述的是变量间的相关性,实际上是一类将联合分布函数与它们各自的边缘分布函数连接在一起的函数 Syntax U = copularnd('Gaussian',rho,N) U = copularnd('t',rho,NU,N) U = copularnd('family',alpha,N) Description U = copularnd('Gaussian',rho,N) returns N random vectors generated from a Gaussian co

24、pula with linear correlation parameters rho. If rho is a p-by-p correlation matrix, U is an n-by-p matrix. If rho is a scalar correlation coefficient, copularnd generates U from a bivariate Gaussian copula. Each column of U is a sample from a Uniform(0,1) marginal distribution. U = copularnd('t',

25、rho,NU,N) returns N random vectors generated from a t copula with linear correlation parameters rho and degrees of freedom NU. If rho is a p-by-p correlation matrix, U is an n-by-p matrix. If rho is a scalar correlation coefficient, copularnd generates U from a bivariate t copula. Each column of U i

26、s a sample from a Uniform(0,1) marginal distribution. U = copularnd('family',alpha,N) returns N random vectors generated from the bivariate Archimedean copula determined by family, with scalar parameter alpha. family is Clayton, Frank, or Gumbel. U is an n-by-2 matrix. Each column of U is a sampl

27、e from a Uniform(0,1) marginal distribution. Examples Determine the linear correlation parameter corresponding to a bivariate Gaussian copula having a rank correlation of -0.5. tau = -0.5 rho = copulaparam('gaussian',tau) rho = -0.7071 % Generate dependent beta random values using tha

28、t copula u = copularnd('gaussian',rho,100); b = betainv(u,2,2); % Verify that the sample has a rank correlation % approximately equal to tau tau_sample = corr(b,'type','kendall') tau_sample = 1.0000 -0.4537 -0.4537 1.0000 Gamrnd (伽马分布) 伽玛分布(Gamma distribution)是统计学的一种连续概率函数

29、Gamma分布中的参数α,称为形状参数(shape parameter),β称为尺度参数(scale parameter)。 Syntax R = gamrnd(A,B) R = gamrnd(A,B,m,n,...) R = gamrnd(A,B,[m,n,...]) Description R = gamrnd(A,B) generates random numbers from the gamma distribution with shape parameters in A and scale parameters in B. A and B can be vecto

30、rs, matrices, or multidimensional arrays that all have the same size. A scalar input for A or B is expanded to a constant array with the same dimensions as the other input. R = gamrnd(A,B,m,n,...) or R = gamrnd(A,B,[m,n,...]) generates an m-by-n-by-... array containing random numbers from the gam

31、ma distribution with parameters A and B. A and B can each be scalars or arrays of the same size as R. Examples n1 = gamrnd(1:5,6:10) n1 = 9.1132 12.8431 24.8025 38.5960 106.4164 n2 = gamrnd(5,10,[1 5]) n2 = 30.9486 33.5667 33.6837 55.2014 46.8265 n3 = gamrnd(2:6,3,1,5) n3 =

32、 12.8715 11.3068 3.0982 15.6012 21.6739 Frnd (F分布,两个卡方分布的自由度) F分布定义为:设X、Y为两个独立的随机变量,X服从自由度为k1的卡方分布,Y服从自由度为k2的卡方分布,这2 个独立的卡方分布被各自的自由度除以后的比率这一统计量的分布。即: 上式F服从第一自由度为k1,第二自由度为k2的F分布 Syntax R = frnd(V1,V2) R = frnd(V1,V2,m,n,...) R = frnd(V1,V2,[m,n,...]) Description R = frnd(V1,V2) g

33、enerates random numbers from the F distribution with numerator degrees of freedom V1 and denominator degrees of freedom V2. V1 and V2 can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input for V1 or V2 is expanded to a constant array with the same dimensions

34、 as the other input. R = frnd(V1,V2,m,n,...) or R = frnd(V1,V2,[m,n,...]) generates an m-by-n-by-... array containing random numbers from the F distribution with parameters V1 and V2. V1 and V2 can each be scalars or arrays of the same size as R. Examples n1 = frnd(1:6,1:6) n1 = 0.0022 0

35、3121 3.0528 0.3189 0.2715 0.9539 n2 = frnd(2,2,[2 3]) n2 = 0.3186 0.9727 3.0268 0.2052 148.5816 0.2191 n3 = frnd([1 2 3;4 5 6],1,2,3) n3 = 0.6233 0.2322 31.5458 2.5848 0.2121 4.4955 Geornd (几何分布) 几何分布是离散型概率分布。其中一种定义为:在n次伯努利试验中,试验k次才得到第一次成功的机率。详细的说,是:前k-1次皆失败,第k次成

36、功的概率。 Syntax R = geornd(P) R = geornd(P,m,n,...) R = geornd(P,[m,n,...]) Description R = geornd(P) generates geometric random numbers with probability parameter P. P can be a vector, a matrix, or a multidimensional array. The size of R is the size of P. The geometric distribution is useful w

37、hen you want to model the number of successive failures preceding a success, where the probability of success in any given trial is the constant P. The parameters in P must lie in the interval [0 1]. R = geornd(P,m,n,...) or R = geornd(P,[m,n,...]) generates an m-by-n-by-... array containing rand

38、om numbers from the geometric distribution with probability parameter P. P can be a scalar or an array of the same size as R. Examples r1 = geornd(1 ./ 2.^(1:6)) r1 = 2 10 2 5 2 60 r2 = geornd(0.01,[1 5]) r2 = 65 18 334 291 63 r3 = geornd(0.5,1,6) r3 = 0 7 1

39、 3 1 0 Poissrnd (泊松分布) 泊松分布适合于描述单位时间内随机事件发生的次数。泊松分布的期望和方差均为λ。 Syntax R = poissrnd(lambda) R = poissrnd(lambda,m,n,...) R = poissrnd(lambda,[m,n,...]) Description R = poissrnd(lambda) generates random numbers from the Poisson distribution with mean parameter lambda. lambda can

40、be a vector, a matrix, or a multidimensional array. The size of R is the size of lambda. R = poissrnd(lambda,m,n,...) or R = poissrnd(lambda,[m,n,...]) generates an m-by-n-by-... array. The lambda parameter can be a scalar or an array of the same size as R. Examples Generate a random sample o

41、f 10 pseudo-observations from a Poisson distribution with λ = 2. lambda = 2; random_sample1 = poissrnd(lambda,1,10) random_sample1 = 1 0 1 2 1 3 4 2 0 0 random_sample2 = poissrnd(lambda,[1 10]) random_sample2 = 1 1 1 5 0 3 2 2 3 4 random_sample3

42、 poissrnd(lambda(ones(1,10))) random_sample3 = 3 2 1 1 0 0 4 0 2 0 random 随机分布函数 Syntax Y = random(name,A) Y = random(name,A,B) Y = random(name,A,B,C) Y = random(...,m,n,...) Y = random(...,[m,n,...]) Description Y = random(name,A) where name is the name of a

43、distribution that takes a single parameter, returns random numbers Y from the one-parameter family of distributions specified by name. Parameter values for the distribution are given in A. Y is the same size as A. Y = random(name,A,B) returns random numbers Y from a two-parameter family of distri

44、butions. Parameter values for the distribution are given in A and B. If A and B are arrays, they must be the same size. If either A or B are scalars, they are expanded to constant matrices of the same size. Y = random(name,A,B,C) returns random numbers Y from a three-parameter family of distribut

45、ions. Parameter values for the distribution are given in A, B, and C. If A, B, and C are arrays, they must be the same size. If any of A, B, or C are scalars, they are expanded to constant matrices of the same size. Y = random(...,m,n,...) or Y = random(...,[m,n,...]) returns an m-by-n-by... mat

46、rix of random numbers. If any of A, B, or C are arrays, then the specified dimensions must match the common dimensions of A, B, and C after any necessary scalar expansion. The following table denotes the acceptable strings for name, as well as the parameters for that distribution Examples Ge

47、nerate a 2-by-4 array of random values from the normal distribution with mean 0 and standard deviation 1: x1 = random('Normal',0,1,2,4) x1 = 1.1650 0.0751 -0.6965 0.0591 0.6268 0.3516 1.6961 1.7971 The order of the parameters is the same as for normrnd. Generate a single random value from Poisson distributions with rate parameters 1, 2, ..., 6, respectively: x2 = random('Poisson',1:6,1,6) x2 = 0 0 1 2 5 7

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服