Quantize and encode floating-point inputs to integer outputs (2024)

Quantize and encode floating-point inputs to integer outputs

collapse all in page

Syntax

y = uencode(u,n)

y = uencode(u,n,v)

y = uencode(u,n,v,'SignFlag')

Description

example

y = uencode(u,n) quantizes the entries in a multidimensional array of floating-point numbers u and encodes them as integers using 2n-level quantization. The output y and the input u are arrays of the same size. The elements of the output y are unsigned integers with magnitudes in the range [0, 2n – 1].

y = uencode(u,n,v) allows the input u to have entries with floating-point values in the range [-v,v] before saturating them (the default value for v is 1).

y = uencode(u,n,v,'SignFlag') maps entries in a multidimensional array of floating-point numbers u whose entries have values in the range [-v,v] to an integer output y. Input entries outside this range are saturated.

Examples

collapse all

Map Floating-Point Scalars to Integers

Open Live Script

Map floating-point scalars in [-1, 1] to uint8 (unsigned) integers. Produce a staircase plot. The horizontal axis ranges from -1 to 1 and the vertical axis from 0 to 7 (i.e., 23-1).

u = -1:0.01:1;y = uencode(u,3);plot(u,y,'.')

Quantize and encode floating-point inputs to integer outputs (1)

Look at saturation effects when you underspecify the peak value for the input.

u = -2:0.5:2;y = uencode(u,5,1)
y = 1x9 uint8 row vector 0 0 0 8 16 24 31 31 31

Specify you want signed output.

u = -2:0.5:2;y = uencode(u,5,2,'signed')
y = 1x9 int8 row vector -16 -12 -8 -4 0 4 8 12 15

Input Arguments

collapse all

uFloating point input
matrix | vector

Floating point input, specified as a matrix or a vector. The input may be real or complex. Elements of the input u outside of the range [-1,1] are treated as overflows and are saturated:

  • For entries in the input u that are less than -1, the value of the output of uencode is 0.

  • For entries in the input u that are greater than 1, the value of the output of uencode is 2n – 1.

Data Types: single | double

nMeasure of number of quantization levels
positive integer scalar

Measure of number of quantization levels, specified as a positive integer scalar. n must be an integer between 2 and 32 (inclusive).

vPeak value
1 (default) | positive real scalar

Peak value, specified as a positive real scalar. Elements of u outside of the range [-v,v] are treated as overflows and are saturated:

  • For input entries less than -v, the value of the output of uencode is 0.

  • For input entries greater than v, the value of the output of uencode is 2n – 1.

'SignFlag'Sign of output
"unsigned" (default) | "signed"

Sign of output, specified as "unsigned" or "signed". The integer type of the output depends on the number of quantization levels 2n and the value of 'SignFlag', which can be one of these:

  • "signed" — Outputs are signed integers with magnitudes in the range [–2n/2, (2n/2) – 1].

  • "unsigned" — Outputs are unsigned integers with magnitudes in the range [0, 2n – 1].

Output Arguments

collapse all

y — Encoded integer outputs
vector | matrix

Encoded integer outputs, returned as a vector or a matrix.

Algorithms

The uencode function maps the floating-point input value to an integer value determined by the requirement for 2n levels of quantization. This encoding adheres to the definition for uniform encoding specified in ITU-T Recommendation G.701. The input range [-v,v] is divided into 2n evenly spaced intervals. Input entries in the range [-v,v] are first quantized according to this subdivision of the input range, and then mapped to one of 2n integers. The range of the output depends on whether or not you specify that you want signed integers.

The output data types are optimized for the number of bits as shown in the table below.

n

Unsigned Integer

Signed Integer

2 to 8

uint8

int8

9 to 16

uint16

int16

17 to 32

uint32

int32

References

[1] International Telecommunication Union. GeneralAspects of Digital Transmission Systems: Vocabulary of Digital Transmissionand Multiplexing, and Pulse Code Modulation (PCM) Terms.ITU-T Recommendation G.701. March, 1993.

Extended Capabilities

Version History

Introduced before R2006a

expand all

The uencode function supports C/C++ code generation.

See Also

udecode

MATLAB Command

You clicked a link that corresponds to this MATLAB command:

 

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Quantize and encode floating-point inputs to integer outputs (2)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本 (日本語)
  • 한국 (한국어)

Contact your local office

Quantize and encode floating-point inputs to integer outputs (2024)
Top Articles
Governor Ron DeSantis Announces Dr. Joseph A. Ladapo as Florida Surgeon General
dalil boubakeur : L'Islam mine l'Europe
Administrative Supplement Program to Add Fluid-based Biomarkers and APOE Genotyping to NINDS ADRD Human Subjects Research Grants
This Modern World Daily Kos
T800 Kenworth Fuse Box Diagram
Ups Drop Off Newton Ks
Tyson Employee Paperless
Word trip Answers All Levels [2000+ in One Page Updated 2023] » Puzzle Game Master
Craigslist Coeur D'alene Spokane
Omniplex Cinema Dublin - Rathmines | Cinema Listings
Craigs List Jonesboro Ar
Unterschied zwischen ebay und ebay Kleinanzeigen: Tipps, Vor- und Nachteile
Oriellys Bad Axe
Shooters Lube Discount Code
Nalo Winds
Machiavelli ‑ The Prince, Quotes & The Art of War
Upper Rank Demons Wiki
NEU: LEAKSHIELD - das sicherste Flüssigkeits-Kühlsystem der Welt - Wasserkühlung
Last minute moving service van local mover junk hauling pack loading - labor / hauling / moving - craigslist
Wells Fargo Banks In Florida
SEBO (UK) Ltd on LinkedIn: #sebouk #commercialcleaning #cleaning #floorcleaning #carpetcleaning
John Wick Megashare
Q Zangle Cvusd
Mapa i lokalizacja NPC w Graveyard Keeper - Graveyard Keeper - poradnik do gry | GRYOnline.pl
Only Murders In The Building Wiki
Tbom Retail Credit Card
MovieHaX.Click
Algebra 1 Unit 1 Interactive Notebook Pages – The Foundations of Algebra
25+ Irresistible PowerXL Air Fryer Recipes for Every Occasion! – ChefsBliss
Pokio.io
More on this Day - March, 7
Case Overview: SAMA IM01 – SFF.Network
Minor Additions To The Bill Crossword
Pervmom Noodle
Tamara Lapman
Adams County 911 Live Incident
Harleyxwest Of Leaks
Today's Wordle Mashable
Craigslist Lake Charles
8662183887
Chalkies | Gutgash's Territory - maps - Mad Max Game Guide
Kutty Com Movies
Traftarım 24
Rockin That Orange Jumpsuit Columbia County
What is Landshark Beer?
Broadcastify Thurston County
Currently Confined Coles County
Welcome to Predator Masters -- Hunting the Hunters
How To Use Price Chopper Points At Quiktrip
22 alternatieve zoekmachines om nu te gebruiken
Wrdu Contests
Evalue Mizzou
Latest Posts
Article information

Author: Jerrold Considine

Last Updated:

Views: 6301

Rating: 4.8 / 5 (58 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Jerrold Considine

Birthday: 1993-11-03

Address: Suite 447 3463 Marybelle Circles, New Marlin, AL 20765

Phone: +5816749283868

Job: Sales Executive

Hobby: Air sports, Sand art, Electronics, LARPing, Baseball, Book restoration, Puzzles

Introduction: My name is Jerrold Considine, I am a combative, cheerful, encouraging, happy, enthusiastic, funny, kind person who loves writing and wants to share my knowledge and understanding with you.