| Simulink® | ![]() |
a = sfrac(TotalBits) a = sfrac(TotalBits, GuardBits)
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 binary 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 binary point in addition to the sign bit.
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
fixdt, float, sfix, sint, ufix, ufrac, uint
![]() | sfix | signalbuilder | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |