Creates a LHS design
sampling = nisp_buildlhs ( s , n )
a 1-by-1 matrix of floating point integers, the number of variables
a 1-by-1 matrix of floating point integers, the number of points
a n by-s matrix of doubles, where sampling(i,j) in [0,1] is the value of the parameter #j for the experiment #i.
This function builds a classical LHS design. This function changes the state of the grand uniform random number generator.
// Create a Lhs design with 5 points in 2 dimensions. n = 5; s = 2; sampling = nisp_buildlhs ( s , n ); scf(); plot ( sampling(:,1) , sampling(:,2) , "bo" ); // Add the cuts cut = linspace ( 0 , 1 , n + 1 ); for i = 1 : n + 1 plot( [cut(i) cut(i)] , [0 1] , "-" ) end for i = 1 : n + 1 plot( [0 1] , [cut(i) cut(i)] , "-" ) end // Create a Lhs design with 1000 points in 2 dimensions. n = 100; s = 2; sampling = nisp_buildlhs ( s , n ); scf(); plot ( sampling(:,1) , sampling(:,2) , "bo" ); xtitle("Latin Hypercube Sampling: 100 points","X1","X2"); scf(); c = linspace(0,1,n+1); subplot(2,1,1); histplot ( c , sampling(:,1)); xtitle("Latin Hypercube Sampling: 100 points","X1","P(X1)"); subplot(2,1,2); histplot ( c , sampling(:,2)); xtitle("Latin Hypercube Sampling: 100 points","X2","P(X2)"); // Create a Lhs design with 1000 points in 2 dimensions. // The first variable is normal, the second is uniform. n = 1000; s = 2; sampling = nisp_buildlhs ( s , n ); // First variable is normal mu = 2; sigma=3; P = sampling(:,1); Q = 1-sampling(:,1); sampling(:,1)=cdfnor("X",mu*ones(n,1),sigma*ones(n,1),P,Q); // Second variable is uniform : do nothing scf(); plot ( sampling(:,1) , sampling(:,2) , "bo" ); xtitle("Latin Hypercube Sampling: 1000 points","X1","X2"); scf(); subplot(2,1,1); histplot ( 50 , sampling(:,1)); xtitle("Latin Hypercube Sampling: 1000 points","X1","P(X1)"); subplot(2,1,2); histplot ( 50 , sampling(:,2)); xtitle("Latin Hypercube Sampling: 1000 points","X2","P(X2)");
"A User's Guide to LHS: Sandia's Latin Hypercube Sampling Software", Gregory D. Wyss and Kelly H. Jorgensen, 1998
"A Comparison of Three Methods for Selecting Values of Input Variables in the Analysis of Output from a Computer Code", M. D. McKay, R. J. Beckman, W. J. Conover, Technometrics, Vol. 21, No. 2 (May, 1979), pp. 239-245