Numeric Derivative - problem entering df

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개)

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

댓글을 달려면 로그인하십시오.

카테고리

Community Treasure Hunt

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

Start Hunting!

Translated by