Decodes quantized integer inputs to floating-point outputs.
y = quantdecode(x, n)
y = quantdecode(x, n, r)
y = quantdecode(x, n, r, s)Legacy name: udecode
Integers to decode. If the elements of x are signed integers, all elements of x must fall in the range [-2^(n-1), 2^(n-1)-1]. Otherwise, all elements of x must fall in the range [0, 2^n-1].
Level of quantization. n is a positive integer between 2 and 32.
Output range. r is a positive number.
Specifies how to treat the overflows. s accepts the following values.
MathScript saturates the elements of x that are outside of the range.
MathScript wraps the elements according to modulo 2^n arithmetic.
Decoded floating-point numbers.
quantdecode does not accept complex inputs. To encode and decode a complex x, use quantencode and quantdecode separately on the real and imaginary parts of x and then combine the results, as shown in the following example:
X = real (input) %get the real part of the input
Y = imag (input) %get the imaginary part of the input
X = quantencode (X, 4, 1, 'unsigned') %encode X
Y = quantencode (Y, 4, 1, 'unsigned') %encode Y
X = quantdecode (X, 4, 1, 'wrap') %decode X
Y = quantdecode (Y, 4, 1, 'wrap') %decode Y
output = complex (X, Y) %combine the real and imaginary parts
X = -1:0.01:1; Y = quantencode(X, 4, 1, 'signed'); X1 = quantdecode(Y, 4, 1); plot(X, X1)
Where This Node Can Run:
Desktop OS: Windows
FPGA: This product does not support FPGA devices