[已解决] 三维等值线图上标记最值

[复制链接]
biyuxiao 发表于 2014-4-28 10:51:56
我的三维等值线图的代码如下:
function III
clc
clear
close all
A=[25 63.5 1798.535817
25 62.5 1798.322753
25 61.5 1798.074917
24 63.5 1797.820427
25 60.5 1797.801854
24 62.5 1797.548923
25 59.5 1797.510799
24 61.5 1797.231615
25 58.5 1797.128392
23 63.5 1797.045714
24 60.5 1797.004311
25 57.5 1796.838966
23 62.5 1796.718296
24 59.5 1796.639668
23 61.5 1796.441159
25 56.5 1796.375959
24 58.5 1796.372083
22 63.5 1796.219292
23 60.5 1796.154648
25 55.5 1795.94328
24 57.5 1795.922466
22 62.5 1795.910078
23 59.5 1795.900231
22 61.5 1795.590614
24 56.5 1795.505349
25 54.5 1795.475534
23 58.5 1795.466339
21 63.5 1795.418786
22 60.5 1795.383496
21 62.5 1795.087903
23 57.5 1795.067292
24 55.5 1795.05227
25 53.5 1795.048677
22 59.5 1795.005401
21 61.5 1794.880568
23 56.5 1794.629395
22 58.5 1794.621
25 52.5 1794.600346
];
x=A(:,1);
y=A(:,2);
z=A(:,3);
xmin=min(x); xmax=max(x);
ymin=min(y); ymax=max(y);
[xx,yy]=meshgrid(linspace(xmin,xmax,30),linspace(ymin,ymax,30));
zz=griddata(x,y,z,xx,yy,'v4');
[c,h]=contour(xx,yy,zz);
clabel(c,h)
x=A(:,1);
y=A(:,2);
z=A(:,3);
xmin=min(x); xmax=max(x);
ymin=min(y); ymax=max(y);
[xx,yy]=meshgrid(linspace(xmin,xmax,30),linspace(ymin,ymax,30));
zz=griddata(x,y,z,xx,yy,'v4');
surf(xx,yy,zz);
% shading interp
hold on
[c h]=contour3(xx,yy,zz);
clabel(c,h);
colormap('gray');
绘制的图像如下:

如何在上面图中标记出最大值?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

最佳答案


bertcool 发表于 2014-4-29 03:15:08
like this?

  1. [val,idx]=max(zz(:));
  2. hold on
  3. scatter3(xx(idx),yy(idx),zz(idx),'go')
复制代码
回复此楼

2 条回复


bertcool 发表于 2014-4-29 03:15:08
like this?

  1. [val,idx]=max(zz(:));
  2. hold on
  3. scatter3(xx(idx),yy(idx),zz(idx),'go')
复制代码
回复此楼

biyuxiao 发表于 2014-5-5 19:39:45
是这样的,非常感谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

相关帖子
热门教程
站长推荐
快速回复 返回顶部 返回列表