| Fixed-Point Toolbox™ | ![]() |
a = fi
a = fi(v)
a = fi(v,s)
a = fi(v,s,w)
a = fi(v,s,w,f)
a = fi(v,s,w,slope,bias)
a = fi(v,s,w,slopeadjustmentfactor,fixedexponent,bias)
a = fi(v,T)
a = fi(v,F)
b = fi(a,F)
a = fi(v,T,F)
a = fi(v,s,F)
a = fi(v,s,w,F)
a = fi(v,s,w,f,F)
a = fi(v,s,w,slope,bias,F)
a = fi(v,s,w,slopeadjustmentfactor,fixedexponent,bias,F)
a = fi(...'PropertyName',PropertyValue...)
a = fi('PropertyName',PropertyValue...)
You can use the fi constructor function in the following ways:
a = fi is the default constructor and returns a fi object with no value, 16-bit word length, and 15-bit fraction length.
a = fi(v) returns a signed fixed-point object with value v, 16-bit word length, and best-precision fraction length.
a = fi(v,s) returns a fixed-point object with value v, signedness s, 16-bit word length, and best-precision fraction length. s can be 0 (false) for unsigned or 1 (true) for signed.
a = fi(v,s,w) returns a fixed-point object with value v, signedness s, word length w, and best-precision fraction length.
a = fi(v,s,w,f) returns a fixed-point object with value v, signedness s, word length w, and fraction length f.
a = fi(v,s,w,slope,bias) returns a fixed-point object with value v, signedness s, word length w, slope, and bias.
a = fi(v,s,w,slopeadjustmentfactor,fixedexponent,bias) returns a fixed-point object with value v, signedness s, word length w, slopeadjustmentfactor, fixedexponent, and bias.
a = fi(v,T) returns a fixed-point object with value v and embedded.numerictype T. Refer to Working with numerictype Objects for more information on numerictype objects.
a = fi(v,F) returns a fixed-point object with value v, embedded.fimath F, 16-bit word length, and best-precision fraction length. Refer to Working with fimath Objects for more information on fimath objects.
b = fi(a,F) allows you to maintain the value and numerictype object of fi object a, while changing its fimath object to F.
a = fi(v,T,F) returns a fixed-point object with value v, embedded.numerictype T, and embedded.fimath F. The syntax a = fi(v,T,F) is equivalent to a = fi(v,F,T).
a = fi(v,s,F) returns a fixed-point object with value v, signedness s, 16-bit word length, best-precision fraction length, and embedded.fimath F.
a = fi(v,s,w,F) returns a fixed-point object with value v, signedness s, word length w, best-precision fraction length, and embedded.fimath F.
a = fi(v,s,w,f,F) returns a fixed-point object with value v, signedness s, word length w, fraction length f, and embedded.fimath F.
a = fi(v,s,w,slope,bias,F) returns a fixed-point object with value v, signedness s, word length w, slope, bias, and embedded.fimath F.
a = fi(v,s,w,slopeadjustmentfactor,fixedexponent,bias,F) returns a fixed-point object with value v, signedness s, word length w, slopeadjustmentfactor, fixedexponent, bias, and embedded.fimath F.
a = fi(...'PropertyName',PropertyValue...) and a = fi('PropertyName',PropertyValue...) allow you to set fixed-point objects for a fi object by property name/property value pairs.
The fi object has the following three general types of properties:
Note These properties are described in detail in fi Object Properties in the Properties Reference. |
The data properties of a fi object are always writable.
bin — Stored integer value of a fi object in binary
data — Numerical real-world value of a fi object
dec — Stored integer value of a fi object in decimal
double — Real-world value of a fi object, stored as a MATLAB® double
hex — Stored integer value of a fi object in hexadecimal
int — Stored integer value of a fi object, stored in a built-in MATLAB integer data type. You can also use int8, int16, int32, uint8, uint16, and uint32 to get the stored integer value of a fi object in these formats
oct — Stored integer value of a fi object in octal
These properties are described in detail in fi Object Properties.
When you create a fi object, a fimath object is also automatically created as a property of the fi object.
fimath — fimath object associated with a fi object
The following fimath properties are, by transitivity, also properties of a fi object. The properties of the fimath object listed below are always writable.
CastBeforeSum — Whether both operands are cast to the sum data type before addition
MaxProductWordLength — Maximum allowable word length for the product data type
MaxSumWordLength — Maximum allowable word length for the sum data type
OverflowMode — Overflow mode
ProductBias — Bias of the product data type
ProductFixedExponent — Fixed exponent of the product data type
ProductFractionLength — Fraction length, in bits, of the product data type
ProductMode — Defines how the product data type is determined
ProductSlope — Slope of the product data type
ProductSlopeAdjustmentFactor — Slope adjustment factor of the product data type
ProductWordLength — Word length, in bits, of the product data type
RoundMode — Rounding mode
SumBias — Bias of the sum data type
SumFixedExponent — Fixed exponent of the sum data type
SumFractionLength — Fraction length, in bits, of the sum data type
SumMode — Defines how the sum data type is determined
SumSlope — Slope of the sum data type
SumSlopeAdjustmentFactor — Slope adjustment factor of the sum data type
SumWordLength — The word length, in bits, of the sum data type
These properties are described in detail in fimath Object Properties.
When you create a fi object, a numerictype object is also automatically created as a property of the fi object.
numerictype — Object containing all the numeric type attributes of a fi object
The following numerictype properties are, by transitivity, also properties of a fi object. The properties of the numerictype object listed below are not writable once the fi object has been created. However, you can create a copy of a fi object with new values specified for the numerictype properties.
Bias — Bias of a fi object
DataType — Data type category associated with a fi object
DataTypeMode — Data type and scaling mode of a fi object
FixedExponent — Fixed-point exponent associated with a fi object
SlopeAdjustmentFactor — Slope adjustment associated with a fi object
FractionLength — Fraction length of the stored integer value of a fi object in bits
Scaling — Fixed-point scaling mode of a fi object
Signed — Whether a fi object is signed or unsigned
Slope — Slope associated with a fi object
WordLength — Word length of the stored integer value of a fi object in bits
These properties are described in detail in numerictype Object Properties.
Note For information about the display format of fi objects, refer to Display Settings. For examples of casting, see Casting fi Objects. |
For example, the following creates a fi object with a value of pi, a word length of 8 bits, and a fraction length of 3 bits:
a = fi(pi, 1, 8, 3)
a =
3.1250
DataTypeMode: Fixed-point: binary point scaling
Signed: true
WordLength: 8
FractionLength: 3
The value v can also be an array:
a = fi((magic(3)/10), 1, 16, 12)
a =
0.8000 0.1001 0.6001
0.3000 0.5000 0.7000
0.3999 0.8999 0.2000
DataTypeMode: Fixed-point: binary point scaling
Signed: true
WordLength: 16
FractionLength: 12
If you omit the argument f, it is set automatically to the best precision possible:
a = fi(pi, 1, 8)
a =
3.1563
DataTypeMode: Fixed-point: binary point scaling
Signed: true
WordLength: 8
FractionLength: 5
If you omit w and f, they are set automatically to 16 bits and the best precision possible, respectively:
a = fi(pi, 1)
a =
3.1416
DataTypeMode: Fixed-point: binary point scaling
Signed: true
WordLength: 16
FractionLength: 13
You can use property name/property value pairs to set fi properties when you create the object:
a = fi(pi, 'roundmode', 'floor', 'overflowmode', 'wrap')
a =
3.1415
DataTypeMode: Fixed-point: binary point scaling
Signed: true
WordLength: 16
FractionLength: 13
fimath, fipref, numerictype, quantizer
![]() | feather | fimath | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |