matlab实现离散PDF随机样本

收录时间:2020-07-24
资源分类:Matlab 工具:MATLAB 7.10 (R2010a)

matlab实现离散PDF随机样本

Random Sample from Discrete PDF

Generate random samples given a pdf. The x and p(x) are specified in the

arguments. See inverse transform sampling, gaussdis, gammadis.

 

Examples:

X = pdfrnd(0:.1:20, gammadis(3,2, 0:.1:20), 100000);

figure, hist(X, 100);

%X will be 100000 samples from gamma distribution with a/k = 3, b/Theta =

%2.

 

X = pdfrnd(-10:.1:10, gaussdis(2, 3, -10:.1:10), 100000);

figure, hist(X, 100);

%X will be 100000 samples from a gaussian distribution with mean 2, var 3.

%Should be roughly equivalent to X = sqrt(3)*randn(100000, 1) + 2;

文件下载列表
pdfrnd.zip (2.8KB)  
附件内容(只显示4中的3个)
gammadis.m  gaussdis.m  pdfrnd.m  
更多

目前尚无评论

用户反馈   关于我们
Copyright (©) ZHIHUISHI.COM 2013 All Rights Reserved.
京ICP备18060134号-2