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