Find max gradient in a slope

56 views (last 30 days)
Marthe Fenne Vestly
Marthe Fenne Vestly on 5 Nov 2017
Answered: Image Analyst on 5 Nov 2017
I have computed displacement depending on slope angle and the result is the plot below. Now I want to find the slope angle where the displacement increases the most, but i can´t figure out how the gradient commands works. Does anyone have a suggestion how to get this information?

Answers (2)

Image Analyst
Image Analyst on 5 Nov 2017
It looks like the displacement increases the most at the last slope angle of each layer. Thus, for layer1, where you have arrays displacement1 and slopeAngle1, the slope where the displacement increases the most would simply be slopeAngle(end). Same for the other 5 layers.

Star Strider
Star Strider on 5 Nov 2017
The gradient (link) function assumes a constant step in each direction you want to calculate. You have to experiment with it with your data to get the result you want.
This should get you started:
t = linspace(0, 25);
x = (1:5)/125;
f = exp(bsxfun(@times, t(:), x)); % Column-Major Array (‘t’ Increases Down Columns)
[drow,dcol] = gradient(f, x, t); % ‘drow’: Across Rows; ‘dcol’: Down Column
figure(1)
semilogy(t, f)
grid
figure(2)
surf(x, t, f)
hold on
mesh(x, t, dcol)
hold off
grid on
view([120 25])

Tags

Community Treasure Hunt

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

Start Hunting!