How to calculate slope/gradient in 3D surface data
80 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Ameer Hamza
2020-4-27
编辑:Ameer Hamza
2020-4-27
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');
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!