1
$\begingroup$

I have 2D arrays of numeric data and I would like to calculate the vector gradient of these arrays.

I would like to achieve something like the 'gradient' function of MatLab: https://www.mathworks.com/help/matlab/ref/gradient.html

In my understanding the 'Grad' function of Mathematica works on expressions of functions. I had a look at other functions but I didn't seem to find anything appropriate. I tried searching on the stackexchange, I apologize if this is trivial or a duplicate, I would really appreciate it if someone could point me in the right direction.

Thank you very much.

$\endgroup$
  • $\begingroup$ I think you need Differences. $\endgroup$ – Αλέξανδρος Ζεγγ Jan 29 '18 at 13:47
  • 1
    $\begingroup$ The two-sided approximation matlab uses (except for the endpoints) is ListCorrelate[{-1, 0, 1}/2, data]. $\endgroup$ – Coolwater Jan 29 '18 at 14:01
  • $\begingroup$ Have you looked at GradientFilter or GradientOrientationFilter? You can find commands where you know part of the name by using wlldcard searches, in this case, ?*Gradient* $\endgroup$ – bill s Jan 29 '18 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.