当前位置: 首页 > 工具软件 > Hypercube > 使用案例 >

matlab lhsdesign函数,Latin hypercube sample

丁雅懿
2023-12-01

Determine the effects of various name-value pair arguments in lhsdesign. Start with a default design for 10 rows and four columns.

rng default % For reproducibility

X = lhsdesign(10,4)

X = 10×4

0.1893 0.2569 0.0147 0.5583

0.8038 0.1089 0.9378 0.1950

0.5995 0.6818 0.3649 0.3097

0.3225 0.8736 0.4487 0.8055

0.9183 0.9854 0.1598 0.2509

0.0131 0.3864 0.5924 0.7511

0.7916 0.7131 0.2760 0.6662

0.6600 0.5420 0.6877 0.9100

0.2740 0.0450 0.7816 0.0631

0.4200 0.4855 0.8760 0.4889

To obtain a discrete design. as opposed to a continuous design, set the 'Smooth' name-value pair argument to 'off'.

rng default % For reproducibility

X = lhsdesign(10,4,'Smooth','off')

X = 10×4

0.2500 0.3500 0.7500 0.8500

0.1500 0.8500 0.2500 0.3500

0.8500 0.7500 0.4500 0.7500

0.9500 0.1500 0.6500 0.1500

0.0500 0.0500 0.8500 0.9500

0.4500 0.5500 0.9500 0.4500

0.3500 0.9500 0.5500 0.0500

0.5500 0.4500 0.0500 0.2500

0.6500 0.6500 0.1500 0.6500

0.7500 0.2500 0.3500 0.5500

The resulting design is discrete.

Calculate the sum of squares of the between-column correlations of the returned design.

y = corr(X);

(sum(y(:).^2) - 4)/2 % Subtract 4 to remove the diagonal terms of corr(X)

ans = 0.4874

Observe the effect of changing the 'Criterion' name-value pair argument to 'correlation', which minimizes the sum of between-column squared correlations. The 'correlation' criterion always gives a discrete design, as if 'Smooth' is set to 'off'.

rng default % For reproducibility

X = lhsdesign(10,4,'Criterion','correlation')

X = 10×4

0.6500 0.0500 0.4500 0.7500

0.2500 0.3500 0.0500 0.1500

0.1500 0.9500 0.8500 0.4500

0.8500 0.5500 0.9500 0.0500

0.5500 0.2500 0.5500 0.3500

0.3500 0.4500 0.7500 0.8500

0.4500 0.1500 0.6500 0.6500

0.0500 0.6500 0.2500 0.5500

0.9500 0.8500 0.3500 0.9500

0.7500 0.7500 0.1500 0.2500

y = corr(X);

(sum(y(:).^2) - 4)/2

ans = 0.0102

Minimizing the correlations results in a design with much lower sum of squared correlations.

Specify fewer iterations to improve the criterion.

rng default % For reproducibility

X = lhsdesign(10,4,'Criterion','correlation','Iterations',2)

X = 10×4

0.6500 0.0500 0.4500 0.7500

0.3500 0.3500 0.0500 0.1500

0.1500 0.9500 0.8500 0.4500

0.9500 0.5500 0.9500 0.0500

0.5500 0.2500 0.5500 0.3500

0.2500 0.4500 0.7500 0.8500

0.4500 0.1500 0.6500 0.6500

0.0500 0.6500 0.2500 0.5500

0.8500 0.8500 0.3500 0.9500

0.7500 0.7500 0.1500 0.2500

y = corr(X);

(sum(y(:).^2) - 4)/2

ans = 0.0328

Lowering the number of iterations results in a worse design (higher sum of squared correlations).

 类似资料: