Table Of Contents

quantdecode

Version:
    Last Modified: March 15, 2017

    Decodes quantized integer inputs to floating-point outputs.

    Syntax

    y = quantdecode(x, n)
    y = quantdecode(x, n, r)
    y = quantdecode(x, n, r, s)
    Legacy name: udecode

    Inputs

    x

    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].

    n

    Level of quantization. n is a positive integer between 2 and 32.

    r

    Output range. r is a positive number.

    Default: 1

    s

    Specifies how to treat the overflows. s accepts the following values.

    Name Description
    'saturate'

    MathScript saturates the elements of x that are outside of the range.

    'wrap'

    MathScript wraps the elements according to modulo 2^n arithmetic.

    Default: 'saturate'

    Outputs

    y

    Decoded floating-point numbers.

    Complex Inputs

    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


    Recently Viewed Topics