| Contents | Index |
q = fixed.Quantizer
q = fixed.Quantizer(nt,rm,oa)
q = fixed.Quantizer(s,wl,fl,rm,oa)
q = fixed.Quantizer(Name,Value)
q = fixed.Quantizer creates a quantizer q that quantizes fixed-point (fi) numbers using default fixed-point settings.
q = fixed.Quantizer(nt,rm,oa) uses the numerictype (nt) object information and the RoundingMethod (rm) and OverflowAction (oa) properties.
q = fixed.Quantizer(s,wl,fl,rm,oa) uses the Signed (s), WordLength (wl), FractionLength (fl), RoundingMethod (rm), and OverflowAction (oa) properties.
q = fixed.Quantizer(Name,Value) creates a quantizer with the property options specified by one or more Name,Value pair arguments. You separate pairs of Name,Value arguments with commas. Name is the argument name, and Value is the corresponding value. Name must appear inside single quotes (''). You can specify several name-value pair arguments in any order as Name1,Value1,…,NameN,ValueN.
Use y = quantize(q,x) to quantize input array x using the fixed-point settings of quantizer q. x can be any fixed-point number fi, except a Boolean value. If x is a scaled double, the x and y data will be the same, but y will have fixed-point settings. If x is a double or single then y = x. This functionality lets you share the same code for both floating-point data types and fi objects when quantizers are present.
Use n = numerictype(q) to get a numerictype for the current settings of quantizer q.
Use clone(q) to create a quantizer object with the same property values as q.
If you use a fixed.quantizer in code generation, note that it is a handle object and must be declared as persistent.
Specify optional comma-separated pairs of Name,Value arguments, where Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
'Bias' |
The bias is part of the numerical representation used to interpret a fixed-point number. Along with the slope, the bias forms the scaling of the number. Default: 0 | |
'FixedExponent' |
Fixed-point exponent associated with the object. The exponent is part of the numerical representation used to express a fixed-point number. The exponent of a fixed-point number is equal to the negative of the fraction length. FixedExponent must be an integer. Default: -15 | |
'FractionLength' |
Fraction length of the stored integer value of the object, in bits. The fraction length can be any integer value. This property automatically defaults to the best precision possible based on the value of the word length and the real-world value of the fi object. Default: 15 | |
'OverflowAction' |
Action to take in case of data overflow. Valid overflow actions are Saturate and Wrap. . Default: Wrap | |
'RoundingMethod' |
Rounding method to apply to the output data. Valid rounding methods are: Ceiling, Convergent, Floor, Nearest, Round, and Zero. Default: Floor | |
'Scaling' |
Scaling mode of the object. The possible values of this property are:
Default: BinaryPoint | |
'Signed' |
Whether the object is signed. The possible values of this property are:
Default: true | |
'Signedness' |
Whether the object is signed, unsigned, or has an unspecified sign. The possible values of this property are:
Default: Signed | |
'Slope' |
Slope associated with the object. The slope is part of the numerical representation used to express a fixed-point number. Along with the bias, the slope forms the scaling of a fixed-point number. Default: 2^-15 | |
'SlopeAdjustmentFactor' |
Slope adjustment associated with the object. The slope adjustment is equivalent to the fractional slope of a fixed-point number. The fractional slope is part of the numerical representation used to express a fixed-point number. SlopeAdjustmentFactor must be greater than or equal to 1 and less than 2. Default: 1 | |
'WordLength' |
Word length of the stored integer value of the object, in bits. The word length can be any positive integer value. Default: 16 |
q |
Quantizer that quantizes fi input numbers |
Fixed-point numbers can be represented as
![]()
where the slope can be expressed as
![]()
Use fixed.Quantizer to reduce the word length that results from adding two fixed-point numbers.
q = fixed.Quantizer; x1 = fi(0.1,1,16,15); x2 = fi(0.8,1,16,15); y = quantize(q,x1+x2);
Use fixed.Quantizer object to change a binary point scaled fixed-point fi to a slope-bias scaled fixed-point fi
qsb = fixed.Quantizer(numerictype(1,7,1.6,0.2),... 'Round','Saturate'); ysb = quantize(qsb,fi(pi,1,16,13));
fi | numerictype | quantizer

Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |