How to calculate slope/gradient in 3D surface data
7 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Ameer Hamza
on 27 Apr 2020
Edited: Ameer Hamza
on 27 Apr 2020
See gradient(): https://www.mathworks.com/help/matlab/ref/gradient.html
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');
See Also
Categories
Find more on Assembly in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!