how to write log base 2 in matlab coding
3 次查看(过去 30 天)
显示 更早的评论
expression for log base 2 in matlab coding
0 个评论
采纳的回答
更多回答(1 个)
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);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!