Matlab:从定制的概率密度函数生成随机数 [英] Matlab: generate random numbers from custom made probability density function

查看:915
本文介绍了Matlab:从定制的概率密度函数生成随机数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据集,其中包含1977-1983年1月的3个月降水量(请参阅附件).但是,我想根据这些数据生成1984-1990年期间的降水量数据.因此,我想知道是否有可能创建一个定制的降水量概率密度函数(1977-1983),并据此生成所需时期(1984-1990)的随机数(降水数据).

在Matlab中有可能吗?有人可以这样做吗?

提前谢谢!

解决方案

直方图将为您提供PDF的估算值-只需将bin计数除以样本总数即可.从那里,您可以通过积分估算CDF.最后,您可以选择一个介于0和1之间的均匀分布的随机数,并估计将产生该数的CDF的参数.也就是说,如果y是您选择的随机数,那么您想要找到x使得CDF(x)= y. x的值将是带有所需PDF的随机数.

I have a dataset with 3-hourly precipitation amounts for the month of January in the period 1977-1983 (see attachment). However, I want to generate precipitation data for the period 1984-1990 based upon these data. Therefore, I was wondering if it would be possible to create a custom made probability density function of the precipitation amounts (1977-1983) and from this, generate random numbers (precipitation data) for the desired period (1984-1990).

Is this possible in Matlab and could someone help me by doing so?

Thanks in advance!

解决方案

A histogram will give you an estimate of the PDF -- just divide the bin counts by the total number of samples. From there you can estimate the CDF by integrating. Finally, you can choose a uniformly distributed random number between 0 and 1 and estimate the argument of the CDF that would yield that number. That is, if y is the random number you choose, then you want to find x such that CDF(x) = y. The value of x will be a random number with the desired PDF.

这篇关于Matlab:从定制的概率密度函数生成随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆