how to write log base 2 in matlab coding

3 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by