# Find max gradient in a slope

111 ビュー (過去 30 日間)
Marthe Fenne Vestly 2017 年 11 月 5 日

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?

サインインしてコメントする。

### 回答 (2 件)

Star Strider 2017 年 11 月 5 日
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])

#### 0 件のコメント

サインインしてコメントする。

Image Analyst 2017 年 11 月 5 日
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.

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!

Translated by