How can I write log(e) in MATLAB?

I am trying to calculate x=log(e) but I can not. Any help?

6 comentarios

sultana saffi
sultana saffi el 16 de Abr. de 2021
x=log(e)
sultana saffi
sultana saffi el 16 de Abr. de 2021
how can i give this function
sultana saffi
sultana saffi el 16 de Abr. de 2021
I am trying to calculate x=log4(256) but i can not.Any help pleas?
sultana saffi
sultana saffi el 16 de Abr. de 2021
x=log4(256)
John D'Errico
John D'Errico el 16 de Abr. de 2021
Surely you can read the formula from that site?
f = @(x) 4.^x - 256;
log4_256 = fzero(f, 1.2345)
log4_256 = 4
4^log4_256
ans = 256

Iniciar sesión para comentar.

 Respuesta aceptada

David Fletcher
David Fletcher el 15 de Abr. de 2018
I assume you mean log10? In Matlab log is base e, so log(e)=1
x=log10(exp(1))

6 comentarios

Melika Qahqaie
Melika Qahqaie el 15 de Abr. de 2018
Thanks alot
Walter Roberson
Walter Roberson el 1 de Feb. de 2019
Note that very few programming languages use log() to indicate log base 10. Excel is the only one I have been able to find. log() or Log[] seems to represent natural log in nearly all languages.
As mentioned Excel uses log for base 10 by default; it has no built in natural log, requiring that a decimal approximation of e be passed as the second parameter for natural log.
I did find one language Kotlin that uses ln for natural log despite being supposedly interoperable with java which uses log for natural log...
Melika Qahqaie
Melika Qahqaie el 1 de Feb. de 2019
thanks for the helpful information
sultana saffi
sultana saffi el 16 de Abr. de 2021
tanx
sultana saffi
sultana saffi el 16 de Abr. de 2021
can you help with this pleas x=log4(256)
John D'Errico
John D'Errico el 16 de Abr. de 2021
@sultana saffi Please stop spamming this question with answers and comments to compute a log to do your homework.
Do you know the basic rule for logs to other bases?
The formula is given here:

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Exponents and Logarithms en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 15 de Abr. de 2018

Comentada:

el 16 de Abr. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by