X = pow2(Y)
X = pow2(F,E)
X = pow2(Y)
returns a matrix X
whose elements are the corresponding elements of Y
raised to the power 2. Y
can also be a vector or a scalar.
X = pow2(F,E)
, for a real matrix F
and a matrix of integers E
, computes X(i,j) = F(i,j).
*(2.^E(i,j))
. The result is computed quickly by simply adding E
to the floating-point exponent of F
.
This function corresponds to the ANSI C function ldexp()
and the IEEE floating-point standard function scalbn()
.
X = pow2(F,E)
yields the following values:
F E X
1/2 1 1
pi/4 2 pi
-3/4 2 -3
1/2 -51 eps
1-eps/2 1024 realmax
1/2 -1021 realmin
^
,.^
,exp
,hex2num
,log2
,realmax
,realmin
(c) Copyright 1994 by The MathWorks, Inc.