how to use rmvnrnd file to draw multivariate truncated normal distributions?

1 view (last 30 days)
Hello all,
could you please share an example of how to use the matlab function rmvnrnd?
I am trying to generate a three multivariate truncated normal with data
MU=[5,4,3]; Sigma = [1 .3 .3; .3 1.5 .4; .3 .4 2.5] N=1000;
A=[-10;10;20]; B=[500,600,1000];
However the limits on A and B looks that are not working, I think I did a wrong specification of them. Could you give me a example please?
what I want to do is to have the limits:
X1 belongs to [-10,500] X2 belongs to [10,600] X3 belongs to [20,1000]
Thanks for your comments!

Answers (1)

the cyclist
the cyclist on 12 Aug 2012
Do you mean this function from the FEX?:
If so, then according to the documentation of that function, A and B are not lower and upper limits. Rather, A*x <= B. So, for example,
>> r = rmvnrnd(0,1,10000000,3,2);
will mean that all of the values of r are less than 2/3.
  2 Comments
Mohammad Anas
Mohammad Anas on 28 Jan 2023
How will i sample from a distribution with mean mu= -100, and variance=0.0000001, such that r should be greater than zero. It is giving nan values.
the cyclist
the cyclist on 28 Jan 2023
I'm confused by what you are asking for.
You want a mean of -100 (i.e. negative 100), with an extremely small variance, and you only want values that are greater than 0? Is that right?
That would be only a tiny, tiny, tiny fraction of the generated values. Like, you'd need to generate a number of values greater than the number of atoms in the universe, before you got a single one greater than 0.
What you are asking for also does not seem like a truncated normal. It sounds like you want the opposite of truncated ... values that are further from the mean than a certain value. You'd need to edit the code to get that.

Sign in to comment.

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!