Section: Random Number Generation
y = randchi(n)
where n is an array containing the degrees of freedom for
each generated random variable.
 
--> f = zeros(7,100); --> x = (1:100)/10; --> for n=1:7;t=x.^(n/2-1).*exp(-x/2);f(n,:)=10*t/sum(t);end --> plot(x,f');
The PDF is below:
 
Here is an example of using randchi and randn to compute
some chi-square random variables with four degrees of freedom.
--> randchi(4*ones(1,6))
ans = 
    8.9675    4.0015    3.2578    5.5461    2.5090    5.7587 
--> sum(randn(4,6).^2)
ans = 
    1.1941   10.6441    3.6228    8.4425    2.5031    1.9058