How can I find the maximum gradient around a data point?
Show older comments
I want to find the x/y indices on a surface where the gradient reaches its maximum around a point P.
For example, let's take the following surface Z:
[X,Y] = meshgrid(-2:.2:2);
Z = X.*exp(-X.^2 - Y.^2);
Z(Z<0) = 0;
[DX,DY] = gradient(Z,.2,.2);
g = sqrt(DX.^2+DY.^2);
figure
contour(X,Y,Z)
hold on
quiver(X,Y,DX,DY)
hold off
Let's say the position of the peak, Z(21,28), is known. Now, I'm looking for the x/y indices, where g (gradient) reaches its highest values around this peak, which would be an oval-like line. How can it be done?
Accepted Answer
More Answers (0)
Categories
Find more on Annotations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!