绘制填充轮廓中的最高点

发布于 2024-09-12 00:01:04 字数 544 浏览 4 评论 0原文

大家好,有人可以帮我使用 Matlab 命令吗?我必须确定使用文件中的矩阵数据绘制的填充轮廓中的最高点。然后我必须用红色 x 标记最高点。

load('0101862_mod.dtm')   % loading the dtm file
X = X0101862_mod(1:81,:)  % we name X0101862, it is the location where the data X, Y and Z is stored
Y = X0101862_mod(82:162,:)
Z = X0101862_mod (163:243,:)

figure (1)
subplot(2,2,3)
[C,h] = contourf(X,Y,Z,10);
xlabel('x'); ylabel('y'); zlabel('z'); title('X0101862_mod');
view(-73,34); axis equal; colormap summer; colorbar;

我知道它涉及 max 命令。当我使用 max 时不断出现错误。

Hi can somebody help me with the Matlab command here. I've got to determine the highest point in a filled contour I've plotted using matrix data in a file. And then I have to mark the highest point with a red x.

load('0101862_mod.dtm')   % loading the dtm file
X = X0101862_mod(1:81,:)  % we name X0101862, it is the location where the data X, Y and Z is stored
Y = X0101862_mod(82:162,:)
Z = X0101862_mod (163:243,:)

figure (1)
subplot(2,2,3)
[C,h] = contourf(X,Y,Z,10);
xlabel('x'); ylabel('y'); zlabel('z'); title('X0101862_mod');
view(-73,34); axis equal; colormap summer; colorbar;

i know it involves max command. Kept getting error when i use max.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

失眠症患者 2024-09-19 00:01:04

要绘制红色“X”,您必须首先调用 hold on 以确保第二个绘图命令不会擦除轮廓。然后,您使用 plot(xMax,yMax,'xr') 在 z 处于最大值的 x/y 坐标处绘制红色“x”。

要查找 xMaxyMax,您必须使用 max 的第二个输出参数。 MAX 作为第一个输出返回最大值 (例如Z),作为第二个输出,它返回最大元素的数量。使用该数字(索引)查找 XY 中与最大 Z 值对应的元素,即 xMaxyMax

To plot the red 'X', you have to call first hold on to make sure that the second plotting command won't erase the contour. Then, you use plot(xMax,yMax,'xr') to plot a red 'x' at the x/y coordinates where z is at its maximum.

To find xMax and yMax, you have to use the second output argument of max. MAX returns, as first output, the maximum (e.g. of Z), and as a second output, it returns the number of the element that is maximal. Use that number (the index) to find the elements in X and Y that correspond to the maximum Z-value, i.e. xMax and yMax.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文