how to write log base 2 in matlab coding

15 ビュー (過去 30 日間)
Prabha Kumaresan
Prabha Kumaresan 2017 年 11 月 8 日
回答済み: Andrew Rockhill 2022 年 9 月 16 日
expression for log base 2 in matlab coding

採用された回答

michio
michio 2017 年 11 月 8 日
Y = log2(X)

その他の回答 (1 件)

Andrew Rockhill
Andrew Rockhill 2022 年 9 月 16 日
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);

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by