numerictype - Construct numerictype object

Syntax

T = numerictype
T = numerictype(s)
T = numerictype(s,w)
T = numerictype(s,w,f)
T = numerictype(s,w,slope,bias)
T = numerictype(s,w,slopeadjustmentfactor,fixedexponent,bias)
T = numerictype(property1,value1, ...)
T = numerictype(T1, property1, value1, ...)
T = numerictype('double')
T = numerictype('single')
T = numerictype('boolean')

Description

You can use the numerictype constructor function in the following ways:

The properties of the numerictype object are listed below. These properties are described in detail in numerictype Object Properties.

Examples

Example 1

Type

T = numerictype

to create a default numerictype object.

T =
              DataType: Fixed
               Scaling: BinaryPoint
                Signed: true
            WordLength: 16
        FractionLength: 15

Example 2

The following creates a signed numerictype object with a 32-bit word length and 30-bit fraction length.

T = numerictype(1, 32, 30)
 
T =
 
          DataTypeMode: Fixed-point: binary point scaling
                Signed: true
            WordLength: 32
        FractionLength: 30

Example 3

If you omit the argument f, the scaling is unspecified.

T = numerictype(1, 32)
 
T =
 
          DataTypeMode: Fixed-point: unspecified scaling
                Signed: true
            WordLength: 32

Example 4

If you omit the arguments w and f, the word length is automatically set to 16 bits and the scaling is unspecified.

T = numerictype(1)
 
T =
 
          DataTypeMode: Fixed-point: unspecified scaling
                Signed: true
            WordLength: 16

Example 5

You can use property name/property value pairs to set numerictype properties when you create the object.

T = numerictype('Signed', true, ...
						'DataTypeMode', 'Fixed-point: slope and bias', ...
						'WordLength', 32, 'Slope', 2^-2, 'Bias', 4)
 
T =
 
          DataTypeMode: Fixed-point: slope and bias scaling
                Signed: true
            WordLength: 32
                 Slope: 0.25
                  Bias: 4

See Also

fi, fimath, fipref, quantizer

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS