MATLAB: Picking random numbers with some predefined probability

MATLABprobability distribution

I have a variable lets say x = 3.3:8.5
I have to pick 200 random numbers from this range but there are a few conditions;
1) I have predefined probabilities of picking random numbers which is p = [0.16 0.24 0.28 0.32] for the intervals [3.3 4.6], [4.6 5.9], [5.9,7.2], and [7.2 8.5].
2) I would like to pick more number of elements from higher end of intervals, for example numbers picked from [7.2 8.5] should be closer to 8.5 than to 7.2.
I am trying to use a normal distribution with mean at 8.5 and truncating it at 3.3 and 8.5. I am playing with standard deviation to find the desired CDF plot.
I would like to know if there is any way to define a distribution by just using the information I have that is more technical than playing with standard deviation. You can find my code attached.
Also, should i include kurtosis and skewness in the definition of distribution? I am not so sure I need skewness since I am already truncating it at 8.5 which also happens to be the mean.
Thanks.

Best Answer

1) I have predefined probabilities of picking random numbers which is p = [0.16 0.24 0.28 0.32] for the intervals [3.3 4.6], [4.6 5.9], [5.9,7.2], and [7.2 8.5].
To implement that, you will need to create a random number in the range [0 1] and find it within the boundaries of cumsum(p) in order to find out which interval it is. Then you would use independent distributions for each of the ranges, each with 100% total probability. This might require using a beta distribution for each of them in practice.
truncate() of a distribution is also a possibility: truncate automatically rescales the values so that the total probability within the truncated range is 100% -- a normal distribution truncated to a range will not look exactly like what would happen if you took a normal distribution and somehow values outside the truncation range just "don't count" and yet magically do not affect the probability calculations. A truncate()'d distribution is still a real distribution with a real pdf() and real cdf() that are meaningful.
2) I would like to pick more number of elements from higher end of intervals, for example numbers picked from [7.2 8.5] should be closer to 8.5 than to 7.2.
You have not really defined how you want to clusture more closely. one approach over the interval [a, b] is to use
(1-exp(-x))/int(1-exp(-x),a,b)
Another is to use
(x^2)/int(x^2,a,b)
but although these work out mathematically, I suspect that over [7.2 8.5] that the shapes of them might not bias the results visibly enough for your purposes.
Related Question