预览加载中,请您耐心等待几秒...
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

亲,该文档总共11页,到这已经超出免费预览范围,如果喜欢就直接下载吧~

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

%Gridfitdemoscript %Thisscriptfileisdesignedtobeusedincellmode %fromthematlabeditor,orbestofall,usethepublish %toHTMLfeaturefromthematlabeditor.Olderversions %ofmatlabcancopyandpasteentireblocksofcodeinto %theMatlabcommandwindow. Topographicdata loadbluff_data; x=bluff_data(:,1); y=bluff_data(:,2); z=bluff_data(:,3); %Tworavinesonahillside.Scannedfroma %topographicmapofanareainupstateNewYork. plot3(x,y,z,'.') %Turnthescannedpointdataintoasurface gx=0:4:264; gy=0:4:400; g=gridfit(x,y,z,gx,gy); figure colormap(hot(256)); surf(gx,gy,g); camlightright; lightingphong; shadinginterp line(x,y,z,'marker','.','markersize',4,'linestyle','none'); title'Usetopographiccontourstorecreateasurface' Fittingatrigonometricsurface clear 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=[[0011]';x;x;1-x;1-x]; y=[[0101]';y;1-y;y;1-y]; figure plot(x,y,'.') title'Datalocationsinthex-yplane' 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)) camlightright lightingphong title'Griddataontrigsurface' %Notethewing-likeartifactsalongtheedges,due %totheuseofaDelaunaytriangulationingriddata. zgrid=gridfit(x,y,z,xi,xi); figure surf(xi,xi,zgrid) colormap(hot(256)) camlightright lightingphong title('Gridfittotrigsurface') Thetrigsurfacewithhighlydifferentscalingsonthexandyaxes xs=x/100; xis=xi/100; ys=y*100; yis=xi*100; %griddatahasproblemswithbadlyscaleddata [xg,yg]=meshgrid(xis,yis); zgd=griddata(xs,ys,z,xg,yg); figure surf(xg,yg,zgd) colormap(hot(256)) camlightright lightingphong title'Seriousproblemsforgriddataonbadlyscaledtrigsurface' %autoscalingon(thedefault) zgrids=gridfit(xs,ys,z,xis,yis,'autoscale','on'); %plottheautoscaledresult figure surf(xis,yis,zgrids) colormap(hot(256)) camlightright lightingphong title'Gridfit(automaticallyscaled)ontrigsurface' Warning:Duplicatex-ydatapointsdetected:usingaverageofthezvalues. Fittin