ln is not working, please help me

1 回表示 (過去 30 日間)
bioter
bioter 2013 年 3 月 6 日
I just want to know how to calculate
b in the equation of, x^b = y
the mathematical solution is ln y /ln x = b; if i remember my math right.
ln doesn't seem to work, can you give me a solution

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 6 日
編集済み: Azzi Abdelmalek 2013 年 3 月 6 日
One solution is
b=log10(y)/log10(x)
Example
x=50;
y=24
b=log10(y)/log10(x)
And now check
x^b

その他の回答 (1 件)

Image Analyst
Image Analyst 2013 年 3 月 6 日
Are you using log()? Because you don't want to use ln() which doesn't exist. log() is the natrual logarithm. What is the error message? Other than that, what you said should work, and in fact is just what Azzi did. log10 or log should both work. Not sure what you did wrong that Azzi did right, unless it was trying to use ln instead of log.
  3 件のコメント
bioter
bioter 2013 年 3 月 7 日
Yes i used the natural log for solving and it worked great, but i wonder why they have that function in mathworks, maybe it is a latest version which i didn't check.
anyway thanks everyone..
Image Analyst
Image Analyst 2013 年 3 月 7 日
I think log and log10 are fairly standard, at least in every programming language I've seen. I've not seen a language with ln, but I agree with you - it should be there. Of course you could define your own m-file called ln.m which is just a wrapper for the log function (calls log() internally).

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLinear Programming and Mixed-Integer Linear Programming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by