資源描述:
《用MATLAB解插值和曲線擬合問(wèn)題》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫(kù)。
1、注:上機(jī)作業(yè)文件夾以自己的班級(jí)姓名學(xué)號(hào)命名,文件夾包括如下上機(jī)報(bào)告和Matlab程序。上機(jī)報(bào)告模板如下:佛山科學(xué)技術(shù)學(xué)院上機(jī)報(bào)告課程名稱數(shù)學(xué)應(yīng)用軟件上機(jī)項(xiàng)目用MATLAB解插值和曲線擬合問(wèn)題專業(yè)班級(jí)一.上機(jī)目的熟練掌握多種插值方法:線性插值,三次樣條插值,三次插值和最近鄰點(diǎn)插值(linear、spline.cubicsnearest)Interpl(x,y,ex,'method')在MATLAB的線性最小二乘擬合中,用得較多的是多項(xiàng)式擬合,其命令為:A=polyfit(x,y,m)二.上機(jī)內(nèi)容1、在飛機(jī)的機(jī)翼加工時(shí),由于機(jī)翼尺寸很大,通常在
2、圖紙上只能標(biāo)出部分關(guān)鍵點(diǎn)的數(shù)據(jù).某型號(hào)飛機(jī)的機(jī)翼上緣輪廓線的部分?jǐn)?shù)據(jù)如下。用插值法求x每改變0」時(shí)的y值,畫(huà)出圖形表示。x04.749.051938577695114133152171190y05.2311.9716.1517」16.3414.63」12」66.697.033.9902、已知觀測(cè)數(shù)據(jù)點(diǎn)如表所示:x00.10.20.30.40.50.60.70.80.91丿-0.4471.9783.286.167.087.347.669.569.489.311.2用3次多項(xiàng)式函數(shù)擬合這些數(shù)據(jù)點(diǎn),畫(huà)出圖形。3^教材習(xí)題1,用griddata插值
3、函數(shù),三次插值。4、教材習(xí)題4,初始值為V()=0,T=0.05三.上機(jī)方法與步驟第1題:要用插值法教每改變0」時(shí)的y值,可以選用程序y=interpl(xheng,yzhong,x,'spline1);xheng=[O4.749.051938577695114133152171190];yzhong=[05.238.111.9716.1517.116.3414.6312.166.697.033.990];x=0:0.1:190;y=interpl(xheng,yzhong,x,fsplinef);plot(xheng,yzhong,1+f
4、zx,y,xheng,yzhong,1r:1)xlabel(1xhen1),ylabel(1yzhon1)截圖:第2題:要用3次多項(xiàng)式函數(shù)擬合這些數(shù)據(jù)點(diǎn),并畫(huà)出圖形,選用程序A=polyfit(xzyz3),z=polyval(A,x);plot(x,y,*k+*,xzz,'r*)編程求解即可。x=0:0.1:1;y=[-0.4471.9783.286.167.087.347.669.569.489.311.2];A=polyfit(x,yz3)z=polyval(A,x);plot(x,y,'k+',x,z,*r1)截圖:FileEdit
5、TextGoCellToolsDebugDesktopWindowHelp%c:t,增cl1.02-3_4_5一x=0:0.1:1;y=[-0.4471.9783.286.167.087.347.669.569.489.311.2]:A=polyfit(x,y,3)z=polyval(A,x):plot(x,yjk+,,x,z/r')f?????feyijiyil.mx[sanciduoxiangshi2?mx]第3題:用griddata插值函數(shù),三次插值,選用cK=griddata(T,P,K,cT,cP,*cubic*)編程。T=[68
6、688787106106140140];P=[9.798113.3249.007813.3559.791814.2779.656312.463];K=[0.08480.08970.07620.08070.06960.07530.06110.0651];cT=99;cP=10.3;cK=griddata(TzPzK,cTzcP,*cubic*)截圖:'Editor?C:User5AdministratorDesktopxishuk3.m-口FileEditTextGoCellToolsDebugDesktopWindowHelp珞■越
7、町色輪旨*41??他
8、IB■鱗FW□唔:?回廠回?目b目1.0+-r1.1x戀疫Q1-T=[68688787106106140140];2-P=[9.798113.3249.007813.3559.791814.2779.656312.463];3-K=[0.08480.08970.07620.08070.06960.07530.06110.0651];4一cT=99;5-cP=10.3;6-cK=griddata(T,P,K,cT,cP,cubic7)8第4題:要確定t,v,選用x=lsqcurvefit(^functionf=curve
9、fun4(x^t)一f=10-(10-x(l))*exp(-t/x(2)):curvefun41,x0zt,v),f=curvefun4(xzt)functionf=curvef