How to calculate slope/gradient in 3D surface data

7 views (last 30 days)
I have this matlab data that looks like this,
X = 1:15;
Y = [5 5 5 10 15 20 25 25 25 20 15 10 5 5 5];
dx = 1;
dy = 1;
Z = (ones(numel(X),1)*Y)+ randn(15,15)
figure
surf(Z)
ylabel('y-axis [um]');
xlabel('x-axis [um]');
zlabel('z-axis [um]');
Im trying to find a way to automatically determine the slope of this 3D surface but I couldnt find it. Can anyone help me?

Answers (1)

Ameer Hamza
Ameer Hamza on 27 Apr 2020
Edited: Ameer Hamza on 27 Apr 2020
X = 1:15;
Y = [5 5 5 10 15 20 25 25 25 20 15 10 5 5 5];
dx = 1;
dy = 1;
Z = (ones(numel(X),1)*Y)+ randn(15,15);
figure
surf(Z)
title('surface');
figure
surf(gradient(Z))
title('gradient');

Community Treasure Hunt

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

Start Hunting!