how to write log base 2 in matlab coding

 Respuesta aceptada

Más respuestas (1)

Andrew Rockhill
Andrew Rockhill el 16 de Sept. de 2022

0 votos

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);

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 8 de Nov. de 2017

Respondida:

el 16 de Sept. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by