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.
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!