calculate the derivative of the function log(sin(2x)), simplify the result

조회 수: 3 (최근 30일)
Yaser Arafat
Yaser Arafat 2016년 12월 13일
댓글: Jan 2016년 12월 13일
pretty(simplify(diff('log(sin(2*x))','x'))) Error using diff Difference order N must be a positive integer scalar.
  댓글 수: 1
Jan
Jan 2016년 12월 13일
@Yaser: In your example the input for diff() is a string, which is treated like a numerical vector containing ASCII codes. Most likely you want a symbolic expression, so see KSSV's answer.

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

답변 (1개)

KSSV
KSSV 2016년 12월 13일
syms x
f = log(sin(2*x));
pretty(simplify(diff(f)))

Community Treasure Hunt

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

Start Hunting!

Translated by