How to get only random samples which are in allowed range and reject the rest?
5 views (last 30 days)
u = rand(3,1)-0.5;
y = - 10 * sign(u).* log(1- 2* abs(u));
The output y is a 3*1 column vector (of samples drawn from Laplacian Distribution).I need to reject those y values which are outside the allowed range say [-15,15](To get samples from Truncated Laplace Distribution) and only accept the in-range values.If I don't get all 3 in-range values in the first iteration,i have to go for second iteration and so on until i get 3 in-range values.
Can you please help me out with the matlab script? It would be also helpful if someone can suggest any other alternative method of drawing i.i.d samples from Truncated Laplace Distribution.