Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

qrandstream

準乱数ストリームの構築

構文

q = qrandstream(type,d)
q = qrandstream(type,d,prop1,val1,prop2,val2,...)
q = qrandstream(p)

説明

q = qrandstream(type,d) は、type で指定された型をもつ、qrandstream クラスの d 次元準乱数ストリーム q を作成します。type は、'halton' または 'sobol' です。q は、それぞれ既定のプロパティ設定を使用した haltonset クラスまたは sobolset クラスによる点集合に基づきます。

q = qrandstream(type,d,prop1,val1,prop2,val2,...) は、ストリームがベースにする点集合のプロパティ名/値ペアを指定します。該当するプロパティは type に依存します。

q = qrandstream(p) は、指定された点集合 p に基づいてストリームを構築します。p は、haltonset クラスまたは sobolset クラスの点集合でなければなりません。

最初の 1000 個の値をスキップし、101 番目ごとの点を保持する点集合に基づいて、3 次元 Halton ストリームを構築します。

q = qrandstream('halton',3,'Skip',1e3,'Leap',1e2)
q = 
   Halton quasi-random stream in 3 dimensions
   Point set properties:
              Skip : 1000
              Leap : 100
    ScrambleMethod : none

nextIdx = q.State
nextIdx =
     1

qrand を使用して、サイズが 4 の 2 つの標本を生成します。

X1 = qrand(q,4)
X1 =
    0.0928    0.3475    0.0051
    0.6958    0.2035    0.2371
    0.3013    0.8496    0.4307
    0.9087    0.5629    0.6166
nextIdx = q.State
nextIdx =
     5

X2 = qrand(q,4)
X2 =
    0.2446    0.0238    0.8102
    0.5298    0.7540    0.0438
    0.3843    0.5112    0.2758
    0.8335    0.2245    0.4694
nextIdx = q.State
nextIdx =
     9

reset を使用してストリームをリセットし、別の標本を生成します。

reset(q)
nextIdx = q.State
nextIdx =
     1

X = qrand(q,4)
X =
    0.0928    0.3475    0.0051
    0.6958    0.2035    0.2371
    0.3013    0.8496    0.4307
    0.9087    0.5629    0.6166

バージョン履歴

R2008a で導入