Gradient is zero yet exists

6 views (last 30 days)
Gavin Seddon
Gavin Seddon on 6 Sep 2017
Edited: John D'Errico on 13 Sep 2017
Hello gradient (140,150), the answer is 0, but it exIhere is my error please? Also, is diff for calculating the derivative? GS.

Accepted Answer

Stephen23
Stephen23 on 6 Sep 2017
Why would you expect
>> gradient(140,150)
ans = 0
to be non-zero? You are asking for the gradient at one point... to be honest I am surprised that it does not return NaN. Did you read the gradient documentation to know what the two arguments are for?
Perhaps you really wanted to do this:
>> gradient([140,150])
ans =
10 10
"Also, is diff for calculating the derivative?"
Did you read the diff documentation? It answers your question, right on the very first line.
  6 Comments
John D'Errico
John D'Errico on 13 Sep 2017
Edited: John D'Errico on 13 Sep 2017
I think I need next to visit Scarborough Fair. They have a large library there, wherein I can do the necessary research. For example, are spades lesser or greater than nails? I think what matters is if some sort of transitivity relation exists in this matter.

Sign in to comment.

More Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by