sfrac
Create a MATLAB structure describing a signed fractional data type.
Syntax
a = sfrac(TotalBits)
a = sfrac(TotalBits, GuardBits)
Description
sfrac(TotalBits)
 returns a MATLAB structure that describes the data type of a signed fractional number with a word size given by TotalBits
.Â
sfrac(TotalBits, GuardBits)
 returns a MATLAB structure that describes the data type of a signed fractional number. The total word size is given by TotalBits
 with GuardBits
 bits located to the left of the sign bit.
sfrac
 is automatically called when a signed fractional data type is specified in a block dialog box.
The default radix point for this data type is assumed to lie immediately to the right of the sign bit. If guard bits are specified, they lie to the left of the radix point in addition to the sign bit.
Example
Define an 8-bit signed fractional data type with 4 guard bits. Note that the range of this number is -24Â = -16 to (1 - 2(1 - 8)).24Â = 15.875.
a = sfrac(8,4)
a =
Class: 'FRAC'
IsSigned: 1
MantBits: 8
GuardBits: 4
Â