1 clc;
2 clear all;
3 close all;
4 M=9;% 维度,几个参数
5 nPop=200;
6 VarMin=[0.6, 0.10, 0.002, 0.02, 0.17, 0.0, 0.17, 0.0, 0.0];%各个参数下限
7 VarMax=[2.0, 0.49, 0.05, 0.30, 2.6, 0.0, 1.30, 0.99, 5.0];%各个参数上限
8 p = sobolset(M);
9 % R=p(1:nPop,:);% 我只用前nPop个
10 R=[];
11 for i=1:nPop
12 r=p(i,:);
13 r=VarMin+r.*(VarMax-VarMin);
14 R=[R; r];
15 end
16 plot(R(:,1),'b*')
当然,matlab中还有其余的抽样类型:
Construct Halton quasi-random point set、Latin hypercube sample、Construct Sobol quasi-random point set、Continuous uniform random numbers
haltonset
Class: haltonset
Construct Halton quasi-random point set
Syntax
p = haltonset(d)
p = haltonset(d,prop1
,val1
,prop2
,val2
,...)
Description
p = haltonset(d)
constructs a d
-dimensional point set p
of the haltonset
class, with default property settings.
p = haltonset(d,
specifies property name/value pairs used to construct prop1
,val1
,prop2
,val2
,...)p
.
The object p
returned by haltonset
encapsulates properties of a specified quasi-random sequence. The point set is finite, with a length determined by the Skip
and Leap
properties and by limits on the size of point set indices (maximum value of 253). Values of the point set are not generated and stored in memory until you access p