how to write log base 2 in matlab coding

 採用された回答

michio
michio 2017 年 11 月 8 日

0 投票

Y = log2(X)

その他の回答 (1 件)

Andrew Rockhill
Andrew Rockhill 2022 年 9 月 16 日

0 投票

To find the log in any base, make use of the base-change formula:
log_b(x) = log_a(x)/log_a(b)
So you can create a function logb = @(b,x) log(x)/log(b);
Then Y = logb(2,x);
Or, more generally;
Y = logb(b,x);

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

質問済み:

2017 年 11 月 8 日

回答済み:

2022 年 9 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by