Draw random number from a truncated distribution with upper bound
Show older comments
Hello everyone,
how can I draw a random number from a truncated normal distribution with mean 0 and varying var (sigma^2)? The upper bound of the truncation value varies within my time series. What I did first is to specify the probability distribution for the different variance values (1xn matrix). After that, I draw a truncated normal distribution for each "row"/ new upper bound. Since I have a huge time series, this step takes forever.
for i = 1:size(pd,2);
t(:,i) = truncate(pd(size(pd,1),i),-inf,upperBound(:,i)));
end
Whenever, this step would be executed I would draw a random number out of each truncated distribution, using
r = random(t(:,1),1);
However, I am not sure if that will work, though.
Is there a way to predefine the matrix for the specification of t? A normal zero/nan etc. matrix doesnt work. And how can I speed up the process to draw from a truncated normal distribution with varying upper bound values?
Accepted Answer
More Answers (0)
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!