Does wblrnd use the inverse tranform method to generate random numbers?

1 view (last 30 days)
Hi everyone,
im working with the Statistics Toolbox, and i want to perform a Monte Carlo Simulation for a Weibull pdf. After reading a lot of papers i found the inverse transform method. My question is, if i use the command wblrnd it generates random values of the pdf defined by shape and scale parameter. If i use the random number generator between 0 and 1 and use the inverse cdf of this Weibull pdf, do i get the same results as wblrnd? In the description of wblrnd there was no explanation how the numbers are generated.
WeibullPDFGB=fitdist(MTTF,'Weibull');
i can extract the shapefactor=2 and scalefactor=4800 for example
is:
z=rand(200,1); y=icdf('Weibull',z,shapefactor,scalefactor);
the same as:
y=wblrnd(shapefactor,scalefactor,200,1); ?
Thanks a lot for the support
Jeremy

Accepted Answer

John D'Errico
John D'Errico on 25 Aug 2018
Edited: John D'Errico on 25 Aug 2018
The answer to many questions about MATLAB, is to just read the code. So, I did this...
type wblrnd
Then look at the code. the last two lines are...
% Generate uniform random values, and apply the Weibull inverse CDF.
r = A .* (-log(rand(sizeOut))) .^ (1./B); % == wblinv(u, A, B)
If that does not seem sufficiently clear, I see this comment in the code:
% WBLRND uses the inversion method.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!