function with ln and log

15 ビュー (過去 30 日間)
Tatiana Macha
Tatiana Macha 2019 年 12 月 13 日
編集済み: Walter Roberson 2019 年 12 月 13 日
I am having issues with plotting.
my function is
y2 = (x-1)(ln((3^.5)/2)*x-ln(3/8));
is not running because of ln but I have changed to log. still an error of some operator.
x range of [1, 3]
y2 = (x-1)(log((3^.5)/2)*x-log(3/8));
plot(x,y2)
Thanks.

回答 (1 件)

Star Strider
Star Strider 2019 年 12 月 13 日
It is missing a multiplication operator:
y2 = (x-1)(log((3^.5)/2)*x-log(3/8));
Try this:
y2 = (x-1).*(log((3^.5)/2).*x-log(3/8));
This also uses element-wise operations. See Array vs. Matrix Operations for an extended discussion.

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by