| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 8536 人关注过本帖, 1 人收藏
标题:函数griddata的超牛改进版,值得一下哦
只看楼主 加入收藏
hitzhang
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:21
帖 子:369
专家分:52
注 册:2006-9-24
收藏(1)
 问题点数:0 回复次数:16 
函数griddata的超牛改进版,值得一下哦
图片附件: 游客没有浏览图片的权限,请 登录注册
gridfitdir.rar (819.4 KB) From www.mathworks.com

收到的鲜花
  • meteora11062008-11-09 19:52 送鲜花  49朵   附言:好文章
搜索更多相关主题的帖子: griddata 函数 改进 
2008-11-09 16:10
meteora1106
Rank: 2
等 级:新手上路
威 望:5
帖 子:126
专家分:0
注 册:2008-9-15
收藏
得分:0 
仁兄,你给大家简要介绍一下么,这是个什么东东。
2008-11-09 19:54
hitzhang
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:21
帖 子:369
专家分:52
注 册:2006-9-24
收藏
得分:0 
% Gridfit demo script

% This script file is designed to be used in cell mode
% from the matlab editor, or best of all, use the publish
% to HTML feature from the matlab editor. Older versions
% of matlab can copy and paste entire blocks of code into
% the Matlab command window.

Topographic dataload bluff_data;
x=bluff_data(:,1);
y=bluff_data(:,2);
z=bluff_data(:,3);
% Two ravines on a hillside. Scanned from a
% topographic map of an area in upstate New York.
plot3(x,y,z,'.')

图片附件: 游客没有浏览图片的权限,请 登录注册

% Turn the scanned point data into a surface
gx=0:4:264;
gy=0:4:400;
g=gridfit(x,y,z,gx,gy);
figure
colormap(hot(256));
surf(gx,gy,g);
camlight right;
lighting phong;
shading interp
line(x,y,z,'marker','.','markersize',4,'linestyle','none');
title 'Use topographic contours to recreate a surface'

图片附件: 游客没有浏览图片的权限,请 登录注册

Fitting a trigonometric surfaceclear

n1 = 15;
n2 = 15;
theta = rand(n1,1)*pi/2;
r = rand(1,n2);

x = cos(theta)*r;
y = sin(theta)*r;
x=x(:);
y=y(:);

x = [[0 0 1 1]';x;x;1-x;1-x];
y = [[0 1 0 1]';y;1-y;y;1-y];
figure
plot(x,y,'.')
title 'Data locations in the x-y plane'

图片附件: 游客没有浏览图片的权限,请 登录注册

z = sin(4*x+5*y).*cos(7*(x-y))+exp(x+y);

xi = linspace(0,1,51);
[xg,yg]=meshgrid(xi,xi);
zgd = griddata(x,y,z,xg,yg);

figure
surf(xi,xi,zgd)
colormap(hot(256))
camlight right
lighting phong
title 'Griddata on trig surface'
% Note the wing-like artifacts along the edges, due
% to the use of a Delaunay triangulation in griddata.
图片附件: 游客没有浏览图片的权限,请 登录注册

zgrid = gridfit(x,y,z,xi,xi);

figure
surf(xi,xi,zgrid)
colormap(hot(256))
camlight right
lighting phong
title('Gridfit to trig surface')

图片附件: 游客没有浏览图片的权限,请 登录注册

The trig surface with highly different scalings on the x and y axesxs = x/100;
xis = xi/100;

ys = y*100;
yis = xi*100;

% griddata has problems with badly scaled data
[xg,yg]=meshgrid(xis,yis);
zgd = griddata(xs,ys,z,xg,yg);

figure
surf(xg,yg,zgd)
colormap(hot(256))
camlight right
lighting phong
title 'Serious problems for griddata on badly scaled trig surface'

% autoscaling on (the default)
zgrids = gridfit(xs,ys,z,xis,yis,'autoscale','on');

% plot the autoscaled result
figure
surf(xis,yis,zgrids)
colormap(hot(256))
camlight right
lighting phong
title 'Gridfit (automatically scaled) on trig surface'

图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册

Fitting the "peaks" surfaceclear

n = 100;
x = (rand(n,1)-.5)*6;
y = (rand(n,1)-.5)*6;

z = peaks(x,y);

xi = linspace(-3,3,101);
zpgf = gridfit(x,y,z,xi,xi);

[xg,yg]=meshgrid(xi,xi);
zpgd = griddata(x,y,z,xg,yg,'cubic');

figure
surf(xi,xi,zpgd)
colormap(jet(256))
camlight right
lighting phong
title 'Griddata (method == cubic) on peaks surface'

figure
surf(xi,xi,zpgf)
colormap(hsv(256))
camlight right
lighting phong
title('Gridfit to peaks surface')

图片附件: 游客没有浏览图片的权限,请 登录注册
图片附件: 游客没有浏览图片的权限,请 登录注册

2008-11-09 21:32
Stirling
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-11-18
收藏
得分:0 
能详细的解释一下么?没看懂什么意思。。。
2008-11-20 08:28
hitzhang
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:21
帖 子:369
专家分:52
注 册:2006-9-24
收藏
得分:0 
我的理解,gridata是把一块有限大的布铺在数据点上,而这个改进的函数是把一块无限大的木板钉在数据点上,这样看起来不仅曲面很光滑而且可以外推作简单的预报。来自www.

2008-11-20 12:27
pocy
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-9-9
收藏
得分:0 
恩 太有才了 真的不错~
2011-09-10 08:37
jeanine123
Rank: 3Rank: 3
等 级:论坛游侠
威 望:2
帖 子:65
专家分:192
注 册:2011-9-17
收藏
得分:0 
学习一下,谢谢楼主分享成果。
2011-10-15 11:21
ejiuguniang
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-3-6
收藏
得分:0 
下载了回帖下  顶起
2012-03-06 15:39
billxiao1021
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-4-18
收藏
得分:0 
非常好,谢谢你的分享!
2012-04-18 21:04
jiatianjie
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-9-2
收藏
得分:0 
程序下载下来应该怎么用啊。。。楼主教教新人吧
2012-09-02 15:07
快速回复:函数griddata的超牛改进版,值得一下哦
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016616 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved