Calculating the slope for all points in a matrix

71 Views Asked by At

My input is a matrix where every value represents the elevation of that point of a topographical map. I need to calculate the direction of downhill for every point. From my research, the gradient descent will essentially give me this value, but from what I can see, I need the function that defines the elevation so that I can find the partial derivatives, but obviously I don't have the function.

I am a novice, but it seems I could use Machine Learning to estimate the function and then calculate the gradient from the defined coefficients.

Ultimately, I am looking for an algorithm to find the direction of the steepest descent for each point in this topographical map.