matlab程序曲面拟合Word文档格式.docx

上传人:b****1 文档编号:13161682 上传时间:2022-10-07 格式:DOCX 页数:11 大小:763.53KB
下载 相关 举报
matlab程序曲面拟合Word文档格式.docx_第1页
第1页 / 共11页
matlab程序曲面拟合Word文档格式.docx_第2页
第2页 / 共11页
matlab程序曲面拟合Word文档格式.docx_第3页
第3页 / 共11页
matlab程序曲面拟合Word文档格式.docx_第4页
第4页 / 共11页
matlab程序曲面拟合Word文档格式.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

matlab程序曲面拟合Word文档格式.docx

《matlab程序曲面拟合Word文档格式.docx》由会员分享,可在线阅读,更多相关《matlab程序曲面拟合Word文档格式.docx(11页珍藏版)》请在冰豆网上搜索。

matlab程序曲面拟合Word文档格式.docx

%Tworavinesonahillside.Scannedfroma

%topographicmapofanareainupstateNewYork.

plot3(x,y,z,'

.'

%Turnthescannedpointdataintoasurface

gx=0:

4:

264;

gy=0:

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;

1-x;

1-x];

y=[[0101]'

y;

1-y;

1-y];

plot(x,y,'

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);

surf(xi,xi,zgd)

colormap(hot(256))

camlightright

lightingphong

Griddataontrigsurface'

%Notethewing-likeartifactsalongtheedges,due

%totheuseofaDelaunaytriangulationingriddata.

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

surf(xi,xi,zgrid)

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);

surf(xg,yg,zgd)

Seriousproblemsforgriddataonbadlyscaledtrigsurface'

%autoscalingon(thedefault)

zgrids=gridfit(xs,ys,z,xis,yis,'

autoscale'

on'

%plottheautoscaledresult

surf(xis,yis,zgrids)

Gridfit(automaticallyscaled)ontrigsurface'

Warning:

Duplicatex-ydatapointsdetected:

usingaverageofthezvalues.

Fittingthe"

peaks"

surface

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);

zpgd=griddata(x,y,z,xg,yg,'

cubic'

surf(xi,xi,zpgd)

colormap(jet(256))

Griddata(method==cubic)onpeakssurface'

surf(xi,xi,zpgf)

colormap(hsv(256))

Gridfittopeakssurface'

Usingtilesingridfit

%Usersofgridfitwhohavereallyhugeproblemsnowhave

%anoption.I'

llgeneratealargeamountofdata,

%andhopetomodelafairlylargegrid-800x800.This

%wouldnormallyrequiregridfittosolveasystemof

%equationswith640,000unknowns.Itwouldprobablybetoo

%largeofaproblemformycomputer,wereItousegridfit

%onthefullproblem.Gridfitallowsyoutobreaktheproblem

%intosmallertilesifyouchoose.Inthiscaseeachtile

%is120x120,witha25%(30element)overlapbetweentiles.

%Relax,thisdemomaytakeacoupleofminutestorun!

!

n=100000;

x=rand(n,1);

y=rand(n,1);

z=x+y+sin((x.^2+y.^2)*10);

xnodes=0:

.00125:

1;

ynodes=xnodes;

[zg,xg,yg]=gridfit(x,y,z,xnodes,ynodes,'

tilesize'

120,'

overlap'

0.25);

surf(xg,yg,zg)

Tiledgridfit'

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 人力资源管理

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1