pow2

Computes powers of 2.

Syntax

R = pow2(X)

R = pow2(F, E)

Inputs

X
Specifies the desired power of two to return.
Dimension: scalar | vector | matrix
F
The number to multiply by 2.^E.
Dimension: scalar | vector | matrix
E
The exponent. Must have the same dimensions as F.
Dimension: scalar | vector | matrix

Outputs

R
The result of either 2.^X or F.*2.^E.

Examples

Simple scalar input:
R = pow2(4)
R = 16
Simple matrix input:
R = pow2([4 3])
R = [Matrix] 1 x 2
16  8
Multiple scalar input with pow2(2,3) being equivalent to 2 * 2^3:
R = pow2(2,3)
R = 16
Multiple matrix input:
R = pow2([2.2,7.7,1.1],[-3,1.8,2.3])
R = [Matrix] 1 x 3
0.27500  26.81296  5.41704