ufrac

Create a MATLAB structure describing an unsigned fractional data type.

Syntax

a = ufrac(TotalBits)

a = ufrac(TotalBits, GuardBits)

Description

ufrac(TotalBits) returns a MATLAB structure that describes the data type of an unsigned fractional number with a word size given by TotalBits. 

ufrac(TotalBits, GuardBits) returns a MATLAB structure that describes the data type of an unsigned fractional number. The total word size is given by TotalBits with GuardBits bits located to the left of the radix point.

ufrac is automatically called when an unsigned 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 left of all bits. If guard bits are specified, then they lie to the left the default radix point.

Example

Define an 8-bit unsigned fractional data type with 4 guard bits. Note that the range of this number is from 0 to (1 - 2-8).24 = 15.9375.

a = ufrac(8,4)

a =

Class: 'FRAC'

IsSigned: 0

MantBits: 8

GuardBits: 4