# How can i take the log2 of x plus 1 of a matrix

2 ビュー (過去 30 日間)
Jose Mendoza Garcia 2022 年 9 月 10 日

i have a table table with variable names and data below it. Id like to take the log base 2 of (x+1)

サインインしてコメントする。

### 回答 (2 件)

John D'Errico 2022 年 9 月 10 日
What function in MATLAB gives the log, with base 2?
help log2
LOG2 Base 2 logarithm and dissect floating point number. Y = LOG2(X) is the base 2 logarithm of the elements of X. [F,E] = LOG2(X) for each element of the real array X, returns an array F of real numbers, usually in the range 0.5 <= abs(F) < 1, and an array E of integers, so that X = F .* 2.^E. Any zeros in X produce F = 0 and E = 0. This corresponds to the ANSI C function frexp() and the IEEE floating point standard function logb(). See also LOG, LOG10, POW2, NEXTPOW2, REALMAX, REALMIN. Documentation for log2 doc log2 Other functions named log2 codistributed/log2 fints/log2 gpuArray/log2 sym/log2
So what line of code would add 1 to x, and then take the log, base 2?
##### 0 件のコメント表示非表示 -1 件の古いコメント

サインインしてコメントする。

Walter Roberson 2022 年 9 月 10 日
output = varfun(@(X) log2(X+1), YourTable)

サインインしてコメントする。

### カテゴリ

Find more on Title Pages, Tables of Contents, Lists of Figures, Tables, and Captions in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by