Matlab won't recognize "ln"

8 ビュー (過去 30 日間)
Rachel Berger
Rachel Berger 2015 年 12 月 6 日
コメント済み: Star Strider 2015 年 12 月 6 日
t=1:0.1:2; y=-1./ln(t+1); plot(t,y)
I'm trying to plot this function but I keep receiving this error. What could I be doing wrong?
Undefined function or variable 'ln'. Error in HW3_2_Actual (line 2) y=-1./ln(t+1);

採用された回答

Star Strider
Star Strider 2015 年 12 月 6 日
In MATLAB (and a number of other programming languages), the natural logarithm function is log, not ‘ln’.
  2 件のコメント
Rachel Berger
Rachel Berger 2015 年 12 月 6 日
Thank you!
Star Strider
Star Strider 2015 年 12 月 6 日
My pleasure!

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

その他の回答 (1 件)

Jan
Jan 2015 年 12 月 6 日
編集済み: Jan 2015 年 12 月 6 日
You can ask the forum, of course. But you would get a faster answer if you ask an internet search engine for "Matlab natural logarithm". And the information can be found in Matlab's documentation also:
docsearch logarithm
Althought Star Stride has solved the problem already, it is worth to mention these two methods, because he needed 17 minutes, while Google found it in less then half a second.
[EDITED, better formulation] It took you 17 minutes to wait for an answer written by Star Strider, although I'm sure he knew the answer even faster than Google. But in the forum additional delays are accumulated: The time for typing the question, the time until it appears in the forum, the time until it is read, the time for typing an answer and submitting it and finally the delay until you read the answer.
  3 件のコメント
Jan
Jan 2015 年 12 月 6 日
編集済み: Jan 2015 年 12 月 6 日
@Star Stride: Oh sorry, I did not meant your part of the process. I was too lazy with the coice of my words. I tried to improve it, see [EDITED]. :-)
Star Strider
Star Strider 2015 年 12 月 6 日
@Jan — Your English is almost infinitely better than my German, so I have no complaints!
Your point is well-taken. Searching the available documentation should be the first option.

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

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by