Contents Previous Next Subchapters

Base Two Logarithm Function
Syntax f = log2(x)
[f,e] = log2(x)
See Also exp , log10 , log

Computes the element-by-element base-two logarithm of x where x is a real, double-precision or complex matrix.

One Return Value
In this case f satisfied the equation
     x = 2
If any of the elements of x are negative, f is a complex matrix. Otherwise f has the same type as x.

Two Return Values
In this case the real part of all the elements of x must be positive and the return values f and e satisfy the equation
     Re[x] = f * 2 
where Re[x] denotes the real part of x, f is a fraction in the interval [.5, 1.) and e is equal to an integer. If f is a complex matrix, f and e are double-precision matrices. Otherwise f and e have the same type as x.

If you enter
     [f, e] = log2( [1, 2, 3, 4] )
     {f , e}
O-Matrix will reply
     [ .5 , .5, .5 ]
     [ 1 , 2 , 2 , 3 ]