フィルターのクリア

diff function for "Differentiate symbolic expression or function" vs "Differences and Approximate Derivatives"

1 回表示 (過去 30 日間)
I am trying to use diff as the first option but it keeps doing the second. How can I make it differentiate instead of doing the differences one? They both have the same function caller.

回答 (1 件)

Ameer Hamza
Ameer Hamza 2018 年 5 月 26 日
If the input is a symbolic expression, it will differentiate it. If the input is a numeric matrix, it will calculate the difference. For example,
syms x
d = diff(sin(x))
d =
cos(x)
also
diff([1 2 3])
ans =
1 1
So it depends on the input type, that how the diff() function will behave.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by