fixed.DataGenerator

Creates value set and generates data

Description

Use the fixed.DataSpecification and fixed.DataGenerator objects to generate simulation inputs to test the full operating range of your designs.

Creation

Description

example

data = fixed.DataGenerator(Name, Value) creates a DataGenerator object with additional properties specified as Name, Value pair arguments.

Properties

expand all

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.

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

getUniqueValuesGet unique values from fixed.DataGenerator object
getNumDataPointsInfoGet information about number of data points in generated data
outputAllDataGet data from fixed.DataGenerator object

Examples

collapse all

Create a DataGenerator object by specifying a DataSpecification object in the constructor.

Create the DataSpecification object with an interval from -2π to 2π 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)
myData = 1x262 single row vector

   -6.2832   -6.2832   -4.0000   -4.0000   -4.0000   -2.0000   -2.0000   -2.0000   -1.0000   -1.0000   -1.0000   -0.5000   -0.5000   -0.5000   -0.2500   -0.2500   -0.2500   -0.1250   -0.1250   -0.1250   -0.0625   -0.0625   -0.0625   -0.0313   -0.0312   -0.0156   -0.0078   -0.0078   -0.0078   -0.0039   -0.0039   -0.0039   -0.0020   -0.0020   -0.0001   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000

Algorithms

expand all

Introduced in R2019b