fixed.DataGenerator
Description
Use the fixed.DataSpecification and fixed.DataGenerator objects to
generate simulation inputs to test the full operating range of your designs.
Creation
Description
creates a data = fixed.DataGenerator(Name, Value)DataGenerator object with additional properties specified as
Name, Value pair arguments.
Properties
DataSpecifications — Properties of generated data
fixed.DataSpecification object | cell array of fixed.DataSpecification objects
Properties of the data to generate, specified as a fixed.DataSpecification object.
Specifying a cell array of DataSpecification objects produces a
single DataGenerator object for input to a system with the same
number of inputs and in the same order as elements in the cell array.
NumDataPointsLimit — Maximum number of data points in generated data
100000 (default) | integer-valued scalar
Maximum number of data points in generated data, specified as an integer-valued
scalar. For more information, see getNumDataPointsInfo.
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64
Object Functions
getUniqueValues | Get unique values from fixed.DataGenerator object |
getNumDataPointsInfo | Get information about number of data points in generated data |
outputAllData | Get data from fixed.DataGenerator object |
Examples
Create a fixed.DataGenerator object
Create a DataGenerator object by specifying a DataSpecification object in the constructor.
Create the DataSpecification object with an interval from to with a data type of single.
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
Use the DataSpecification object to create a DataGenerator object. Limit the number of data points in the generated data to 5000 points. You can specify these properties as name-value pairs in the constructor of the DataGenerator object.
datagen = fixed.DataGenerator('DataSpecifications',dataspec,... 'NumDataPointsLimit',5000)
datagen =
fixed.DataGenerator with properties:
DataSpecifications: {[1x1 fixed.DataSpecification]}
NumDataPointsLimit: 5000
Use the outputAllData function to see the generated data.
myData = outputAllData(datagen);
Algorithms
Data Generation for One-Dimensional, Two-Dimensional, and Complex Data
When you use a DataGenerator object to generate data for a
DataSpecification object with the Dimensions property
set to 1, the output data always contains the minimum and maximum values of the specified
intervals, and any values specified by the MandatoryValues
property.
When you generate data for a DataSpecification object with the
Dimensions property set to a value greater than 1, the output is
generated by taking a cartesian product of the one-dimensional output.
For example, consider the following two DataSpecification objects. The
two objects are identical except that one is one-dimensional, and the other is
two-dimensional.
dataspec_1d = fixed.DataSpecification('single',... 'Intervals', {-1,1}, 'Dimensions',1); dataspec_2d = fixed.DataSpecification('single',... 'Intervals', {-1,1}, 'Dimensions',2);
DataGenerator objects based on these specifications. Set the maximum
number of data points in the generated data to
inf.datagen_1d = fixed.DataGenerator('DataSpecifications', ... dataspec_1d, 'NumDataPointsLimit', inf); datagen_2d = fixed.DataGenerator('DataSpecifications', ... dataspec_2d, 'NumDataPointsLimit', inf);
Get the size of the generated data for each of the configurations.
size_1d_data = size(outputAllData(datagen_1d)) size_2d_data = size(outputAllData(datagen_2d))
size_1d_data =
1 244size_2d_data =
2 59536The DataGenerator generates complex data in a similar way to the
two-dimensional data. Create a DataSpecification object with
Dimensions set to 1 and the
Complexity set to complex. Create a
DataGenerator object using this
specification.
dataspec_complex = fixed.DataSpecification('single', ... 'Intervals', {-1,1}, 'Dimensions', 1, 'Complexity', 'complex');
datagen_complex = fixed.DataGenerator('DataSpecifications', ... dataspec_complex, 'NumDataPointsLimit', inf);
Get the size of the generated data from this configuration.
size_complex_data = size(outputAllData(datagen_complex))
size_complex_data =
1 59536The length of the output data for the one-dimensional complex data is the same as the length of the two-dimensional real data.
Version History
Introduced in R2019b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)