how do i get x,y and z co-ordinates of the peak in a mesh?
1 次查看(过去 30 天)
显示 更早的评论
i plotted a mesh and i am trying to get the exact co-ordinates of the peak.
0 个评论
回答(1 个)
DGM
2022-1-6
You should be able to use max() on the z data. How you look up the corresponding x,y values depends on how your data is arranged.
[x,y,z] = peaks(100); % x,y are matrices
[~,idx] = max(z,[],'all','linear');
[m n] = ind2sub(size(z),idx);
peakloc = [x(1,n) y(m,1) z(m,n)]
mesh(x,y,z); hold on
plot3(peakloc(1),peakloc(2),peakloc(3),'o')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!