MATLAB Answers

How can I write log(e) in MATLAB?

335 views (last 30 days)
I am trying to calculate x=log(e) but I can not. Any help?

  0 Comments

Sign in to comment.

Accepted Answer

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

  3 Comments

Walter Roberson
Walter Roberson on 1 Feb 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 on 1 Feb 2019
thanks for the helpful information

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags