I 've found the best fitting of a variable distribution (D(:,2)) using the function "allfitdist". Now i want to save this result in a structure and then i want to randomly sample 10000 times from this result. I'm using this code:
[Ddg2 PDdg2] = allfitdist(D(:,2),'cdf')
My(2).result = PDdg2{1,1} %generalized pareto
output = random(My(2).result,10000)
Something is weard because in the output i get a really big matrix. Maybe i'm wrong in the third raw of the code, when i randomly sample from this distribution. Someone can help me?
The documentation of random
says:
R = random(___,sz1,...,szN)
orR = random(___,[sz1,...,szN])
generates asz1
-by-⋯-by-szN
array of random numbers from the specified probability distribution using input arguments...
...
If you specify a single valuesz1
, thenR
is a square matrix of sizesz1
.
You have specified sz1
as 10000
which is a single value and hence your output
matrix is 10000×10000
.
So the solution is:
output = random(pd,1,10000);