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.

回答(1 个)

DGM
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)]
peakloc = 1×3
-0.0303 1.6061 8.0926
mesh(x,y,z); hold on
plot3(peakloc(1),peakloc(2),peakloc(3),'o')

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by