No BSD License  

Highlights from
Latin Hypercube Sampling

from Latin Hypercube Sampling by Budiman Minasny
Latin Hypercube Sampling

s=ransamp(xmean,xsd,corr,nsample)
function s=ransamp(xmean,xsd,corr,nsample)
% s=ransamp(xmean,xsd,corr,nsample)
% random sampling with correlation
% Input:
%   xmean     : mean of data (1,nvar)
%   xsd       : std.dev of data (1,nvar)
%   corr      : correlation matrix of the variables (nvar,nvar)
%   nsample   : no. of samples
% Output:
%   s       : random sample (nsample,nvar)
% Uses Matlab function: randn
%   Budiman (2003)

nvar=length(xmean);
% random sampling 
L = chol(corr);
z = randn(nvar,nsample);
y = L' * z ;
s = (y'.*repmat(xsd,nsample,1))+ repmat(xmean,nsample,1);

Contact us at files@mathworks.com