Truncating a normal/Gaussian distribution

3 ビュー (過去 30 日間)
Michael
Michael 2011 年 6 月 28 日
Hi, I'm trying to create an mxn matrix of normal random variables such that the mean for each column is 2, variance for each column can be specified (for example variance of column 1 is 4, column 2 is 3 etc). Also, I want to be able to specify the correlation between each column. However, each entry needs to be truncated so that it can't be less than -1. Could anyone help me? Thank you!

回答 (1 件)

David Young
David Young 2011 年 6 月 28 日
You can do truncation like this:
truncated = max(original, -1);
but note that your results will not be from a normal distribution any more.
Another way to ensure the values are all -1 or greater would be to replace the bad ones with a new random sample, repeating until all the values are ok. Whatever method you use, the results will not be from a normal distribution.
For setting the mean and variance, see Example 1 in the documentation for randn. Whether this is sufficient depends on whether you want to set the mean and variance before or after the truncation.
For setting the cross-correlations, I guess that one applies a matrix transform to a matrix of independently-generated values - you should be able to find a reference to this.

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by