I want to generate a random series x with length N through the following rule related to non-central chi-square distribution:
xn+1~χν2(λxn)
where ν is a given constant representing degrees of freedom, λ is also pre-specified and the multiplication of λ and xn is the non-centrality parameter, x1 is supposed to be given. I have tested the case of generating N=100000
samples of non-central chi-square distribution with both parameters 1.5 and find using the MATLAB built-in generator ncx2rnd
with one statement
x=ncx2rnd(1.5, 1.5*ones(1,100000));
will be much faster than generating 1 sample once using for-loop repeating 100000 times:
for i=1:100000
x(i)=ncx2rnd(1.5, 1.5);
end
So is there any MATLAB statement to generate random series in which the distribution of each term is dependent of its predecessor without using any for-loop?
Aucun commentaire:
Enregistrer un commentaire