about gradient and diff
Ältere Kommentare anzeigen
The help of my matlab says: (in article "gradient -Gradient vector of scalar function")
-If x is a scalar, gradient(f,x) = diff(f, x).
This is wrong, right?
diff(f,2) should = diff( diff(f) ) % means 2nd order diff
while gradient (f, 2) means the grid increment is 2. which means, for a curve f-t, or f(t), t is a linear space and dt = t(2)-t(1) = 2
Let me know everybody~ Thanks~
5 Kommentare
Matt J
am 15 Jun. 2013
Which gradient() and diff() methods are you referring to? The ones in the Symbolic Toolbox?
Image Analyst
am 15 Jun. 2013
For base MATLAB, the help says this:
"Y = diff(X,n) applies diff recursively n times,resulting in the nth difference. Thus, diff(X,2) isthe same as diff(diff(X))."
Yuji Zhang
am 15 Jun. 2013
Image Analyst
am 15 Jun. 2013
How do you tell your code which one to use?
Yuji Zhang
am 15 Jun. 2013
Bearbeitet: Yuji Zhang
am 15 Jun. 2013
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Calculus finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!