Calculate the Natural logarithm ln

6 views (last 30 days)
Saif Alsulimmani
Saif Alsulimmani on 31 Mar 2019
Commented: Steven Lord on 9 Dec 2019
I'm trying to calculate the natural log of temperature and pressure ratio for an ideal gas in order to find the entropy change.
I've read some articles that says it's the same thing as log(x), but that doesn't make any sense.
I have some literture data to compare with. Using log(x) gives me incorrect values.
Is there a way to use the natural log ln in MATLAB?
  3 Comments
Irma Espinoza
Irma Espinoza on 9 Dec 2019
I have the same problem, I'm trying to get natural logarithm of vector STR1, please see below.The result I get for each of the elements is incorrect, for example, element 1 is 1.00001626396027 , the natural logaritm I get from matlab is 0.016263828016221, the result I get from excel and other methods is 0.0000162638280133342.
for n=1:finish
STR11(n)=log(STR1(1,n))
end
Steven Lord
Steven Lord on 9 Dec 2019
Make sure you're using the version of the log function included in MATLAB, not one you've written or obtained elsewhere.
which -all log
Can you show us the output of that command? This should list two built-in functions and (depending on which toolboxes you have installed) a few others all under the toolbox subdirectory of matlabroot.

Sign in to comment.

Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!