fixed.DataGenerator
説明
fixed.DataSpecification
オブジェクトと fixed.DataGenerator
オブジェクトを使用して、設計の動作範囲全体をテストするシミュレーション入力を生成します。
作成
説明
は data
= fixed.DataGenerator(Name, Value
)Name, Value
のペアの引数として指定された追加のプロパティで DataGenerator
オブジェクトを作成します。
プロパティ
DataSpecifications
— 生成されたデータのプロパティ
fixed.DataSpecification
オブジェクト | fixed.DataSpecification
オブジェクトの cell 配列
生成するデータのプロパティ。fixed.DataSpecification
オブジェクトとして指定します。
DataSpecification
オブジェクトの cell 配列を指定すると、その cell 配列内の要素と同じ入力数および同じ順序で、システムへの入力用に単一の DataGenerator
オブジェクトが生成されます。
NumDataPointsLimit
— 生成されたデータにおけるデータ点の最大数
100000 (既定値) | 整数値のスカラー
生成されたデータにおけるデータ点の最大数。整数値スカラーとして指定します。詳細については、getNumDataPointsInfo
を参照してください。
データ型: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
オブジェクト関数
getUniqueValues | fixed.DataGenerator オブジェクトからの一意の値の取得 |
getNumDataPointsInfo | 生成されたデータのデータ点の数に関する情報の取得 |
outputAllData | fixed.DataGenerator オブジェクトからのデータの取得 |
例
fixed.DataGenerator
オブジェクトの作成
コンストラクターで DataSpecification
オブジェクトを指定して、DataGenerator
オブジェクトを作成します。
から までの区間で、single
のデータ型をもつ DataSpecification
オブジェクトを作成します。
dataspec = fixed.DataSpecification('single',... 'Intervals',{-2*pi, 2*pi})
dataspec = fixed.DataSpecification with properties: DataTypeStr: 'single' Intervals: [-6.2832,6.2832] ExcludeDenormals: false ExcludeNegativeZero: false MandatoryValues: <empty> Complexity: 'real' Dimensions: 1
DataSpecification
オブジェクトを使用して DataGenerator
オブジェクトを作成します。生成されたデータのデータ点の数を 5000 点に制限します。これらのプロパティを名前と値のペアとして DataGenerator
オブジェクトのコンストラクターで指定できます。
datagen = fixed.DataGenerator('DataSpecifications',dataspec,... 'NumDataPointsLimit',5000)
datagen = fixed.DataGenerator with properties: DataSpecifications: {[1x1 fixed.DataSpecification]} NumDataPointsLimit: 5000
関数 outputAllData
を使用して生成されたデータを表示します。
myData = outputAllData(datagen);
アルゴリズム
1 次元、2 次元、複素数データのデータ生成
DataGenerator
オブジェクトを使用して Dimensions
プロパティが 1 に設定された DataSpecification
オブジェクトのデータを生成すると、その出力データには常に、指定された区間の最小値と最大値、および MandatoryValues
プロパティで指定された任意の値が含まれます。
Dimensions
プロパティが 1 より大きい値に設定された DataSpecification
オブジェクトのデータを生成すると、その出力は、1 次元出力のデカルト積を使用することで生成されます。
たとえば、次の 2 つの DataSpecification
オブジェクトを考えます。一方が 1 次元で他方が 2 次元であることを除き、2 つのオブジェクトは同一です。
dataspec_1d = fixed.DataSpecification('single',... 'Intervals', {-1,1}, 'Dimensions',1); dataspec_2d = fixed.DataSpecification('single',... 'Intervals', {-1,1}, 'Dimensions',2);
DataGenerator
オブジェクトを作成します。生成されたデータで、データ点の最大数を inf
に設定します。datagen_1d = fixed.DataGenerator('DataSpecifications', ... dataspec_1d, 'NumDataPointsLimit', inf); datagen_2d = fixed.DataGenerator('DataSpecifications', ... dataspec_2d, 'NumDataPointsLimit', inf);
構成ごとに、生成されたデータのサイズを取得します。
size_1d_data = size(outputAllData(datagen_1d)) size_2d_data = size(outputAllData(datagen_2d))
size_1d_data = 1 244
size_2d_data = 2 59536
DataGenerator
は 2 次元データと同様の方法で複素数データを生成します。Dimensions
が 1
で Complexity
が complex
に設定された DataSpecification
オブジェクトを作成します。この仕様を使用して DataGenerator
オブジェクトを作成します。
dataspec_complex = fixed.DataSpecification('single', ... 'Intervals', {-1,1}, 'Dimensions', 1, 'Complexity', 'complex');
datagen_complex = fixed.DataGenerator('DataSpecifications', ... dataspec_complex, 'NumDataPointsLimit', inf);
この構成から、生成されたデータのサイズを取得します。
size_complex_data = size(outputAllData(datagen_complex))
size_complex_data = 1 59536
1 次元複素数データの出力データの長さは 2 次元実数データの長さと同一です。
バージョン履歴
R2019b で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)