Main Content

lsb

Scaling of least significant bit of fi object, or value of least significant bit of quantizer object

Description

example

b = lsb(a) returns the scaling of the least significant bit of fi object a. The result is equivalent to the result given by the eps function.

example

p = lsb(q) returns the quantization level of quantizer object q or the distance from 1.0 to the next largest floating-point number if q is a floating-point quantizer object.

Examples

collapse all

Use the lsb function to find the value of the scaling of the least significant bit of fi object a.

Create a signed fi object that specifies a word length of 8 bits and a fraction length of 7 bits.

a = fi([],1,8,7)
a = 

[]

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 8
        FractionLength: 7

Determine the least significant bit of the fi object.

lsb(a)
ans = 
    0.0078

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 8
        FractionLength: 7

Use the lsb function to find the value of the least significant bit of the quantizer object q.

Create a fixed-point quantizer object that specifies a word length of 8 bits and a fraction length of 7 bits.

q = quantizer('fixed',[8 7])
q =


        DataMode = fixed
       RoundMode = floor
    OverflowMode = saturate
          Format = [8  7]

Determine the quantization level of the quantizer object.

p = lsb(q)
p = 0.0078

For both fixed-point and floating-point quantizer objects q, lsb(q) = 2^-FRACTIONLENGTH(q).

lsb(q)==2^-7
ans = logical
   1

Input Arguments

collapse all

Input array, specified as a fi object.

Data Types: fi
Complex Number Support: Yes

Input quantizer object, specified as a quantizer object.

Extended Capabilities

HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.

Version History

Introduced before R2006a