Hi,
I have a function (e(1)^(cos(x^2))+ln(1+x^2)...I derived it correctly to (2*x/1+x^2)-2*x*sin(x^2)*(e(1)^cos(x^2))
Then I tried to enter it to Matlab in this form:
df=(2*x./(1+x.^2))-(2*x.*sin(x.^2)*exp(1)^(cos(x.^2)))
But I am still having this error: Error using ==> mpower Inputs must be a scalar and a square matrix. To compute elementwise POWER, use POWER (.^) instead.
I really don't know where else I have to put the dots...
Can somebody fix this expression, please ??
Thanks a lot

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 7 日
編集済み: Azzi Abdelmalek 2013 年 5 月 7 日

1 投票

df=2*x./(1+x.^2)-2*x.*sin(x.^2).*exp(1).^cos(x.^2)

1 件のコメント

Jiri
Jiri 2013 年 5 月 7 日
Thanks a lot, it helped :)

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

その他の回答 (1 件)

Roger Stafford
Roger Stafford 2013 年 5 月 7 日

0 投票

Matlab is complaining about the "*" operator just after "sin(x.^2)". It should be ".*". Also you should be using matlab's 'exp' function:
df=(2*x./(1+x.^2))-(2*x.*sin(x.^2).*exp(cos(x.^2));

1 件のコメント

Jiri
Jiri 2013 年 5 月 7 日
編集済み: Jiri 2013 年 5 月 7 日
I am using Euler number

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

カテゴリ

ヘルプ センター および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by