Main Content

oct2poly

Convert octal number to binary coefficients

Description

example

b = oct2poly(oct) converts an octal number, oct, to a vector of binary coefficients, b.

b = oct2poly(oct,ord) specifies the power order, ord, of the coefficients that comprise the output. If omitted, ord is 'descending'.

Examples

collapse all

Convert the octal number 11 to a binary vector.

b = oct2poly(11)
b = 1×4

     1     0     0     1

The binary vector corresponds to the polynomial x3+1.

Convert the octal number 65 to an ascending order binary vector.

b = oct2poly(65,'ascending')
b = 1×6

     1     0     1     0     1     1

Sixty-five octal is the generator polynomial of a (15,10) Hamming code in the Bluetooth® v4.0 standard. The binary representation of 65 octal is 110101 and the GF(2) polynomial is 1+x2+x4+x5 or [1 0 1 0 1 1] in ascending powers.

Input Arguments

collapse all

Octal number, specified as a positive integer scalar.

Example: 15

Example: 3177

Data Types: double

Power order of the binary coefficients vector, specified as a character vector having a value of 'ascending' or 'descending'.

Data Types: char

Output Arguments

collapse all

Binary coefficients representing a polynomial, returned as a row vector having length equal to p + 1, where p is the order of octal input.

Version History

Introduced in R2015b

See Also

|