Products & Services Solutions Academia Support User Community Company

Learn more about Fixed-Point Toolbox   

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 =
 

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 15

Example 2

The following code 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
            Signedness: Signed
            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
            Signedness: Signed
            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
            Signedness: Signed
            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
            Signedness: Signed
            WordLength: 32
                 Slope: 0.25
                  Bias: 4

Example 6

You can create a numerictype object with an unspecified sign by using property name/property values pairs to set the Signedness property to Auto.

T = numerictype('Signedness', 'Auto')
 
T =
 

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Auto
            WordLength: 16
        FractionLength: 15

See Also

fi, fimath, fipref, quantizer

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

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