how to write log base 2 in matlab coding

9 Ansichten (letzte 30 Tage)
Prabha Kumaresan
Prabha Kumaresan am 8 Nov. 2017
Beantwortet: Andrew Rockhill am 16 Sep. 2022
expression for log base 2 in matlab coding

Akzeptierte Antwort

michio
michio am 8 Nov. 2017
Y = log2(X)

Weitere Antworten (1)

Andrew Rockhill
Andrew Rockhill am 16 Sep. 2022
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);

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by