




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、題目:利用插值實(shí)現(xiàn)數(shù)據(jù)的插值和分段三次小組成員:王曉波(1蔡明宇()一、程序?qū)崿F(xiàn)意義:一般的,從各種試驗(yàn)得來(lái)的數(shù)據(jù)總有一定的數(shù)量,而利用插值技術(shù)能夠從有限的數(shù)據(jù)中獲取整體的狀態(tài)。而Hermite插值不僅保證了插值函數(shù)與原函數(shù)在給定數(shù)據(jù)點(diǎn)處得擬合,同時(shí)保證了在相應(yīng)點(diǎn)處導(dǎo)數(shù)的相同,從而在很大程度上保證了曲線的“光滑性”。因此,通過(guò)Matlab實(shí)現(xiàn)Hermite插值具有很普遍的意義。二、實(shí)現(xiàn)過(guò)程:1、Hermite插值由于并不是所有的Matlab版本都提供現(xiàn)有的Hermite插值函數(shù)包,故我們首先編寫(xiě)了實(shí)現(xiàn)給定五個(gè)觀測(cè)點(diǎn)的Hermite插值的M程序,代碼如下:functionf,f0=Hermite
2、1(x,y,y_1)symst;f=0.0;if(length(x)=length(y)if(length(y)=length(y_1)n=length(x);elsedisp(y和y的導(dǎo)數(shù)的維數(shù)不相等);return;endelsedisp(x和y的維數(shù)不相等!);return;endfori=1:nh=1.0;a=0.0;forj=1:nif(j=i)h=h*(t-x(j)人2/(x(i)-x(j)人2);a=a+1/(x(i)-x(j);endendf=f+h*(x(i)-t)*(2*a*y(i)-y_1(i)+y(i);endf0=subs(f,t);其中為給定點(diǎn)橫坐標(biāo)數(shù)組,為給定點(diǎn)縱
3、坐標(biāo)數(shù)組,為原函數(shù)在給定點(diǎn)處的導(dǎo)數(shù)數(shù)組。測(cè)試證明該程序可以實(shí)現(xiàn),例如輸入如下數(shù)組:x=1:0.2:1.8;y_1=0.50.45640.42260.39530.3727;y=11.09541.18321.26491.3416;f,f0=Hermite1(x,y,y_1);運(yùn)行結(jié)果如下:f=TOC o 1-5 h z(390625*(337232823972231*t)/35184372088832-114418258618928321/10995116277760000)*(t-1)人2*(t-7/5)人2*(t-8/5)人2*(t-9/5)人2)/36-(390625*(t-1)A2*(t-
4、6/5)A2*(t-7/5)A2*(t-9/5)A2*(2855713758717179*t)/281474976710656-384779664999124623/21990232555520000)/36+(390625*(64*t)/3-61/3)*(t-6/5)A2*(t-7/5)A2*(t-8/5)A2*(t-9/5)A2)/576+(390625*(7612884810106783*t)/18014398509481984+6660373488918492043/11258999068426240000)*(t-1)A2*(t-6/5)A2*(t-8/5)A2*(t-9/5)A2)
5、/16-(390625*(7762319875242775*t)/281474976710656-8968626627620006931/175921860444160000)*(t-1)A2*(t-6/5)A2*(t-7/5)A2*(t-8/5)A2)/576f0=1.1000利用matlab繪制圖像:FigureFileEditViewInsertToolsDtEktopWindowHelpH3口匡1口1.41.351.32、程序的窗口化:利用Matlab:GUI代碼如下:1.25提供的GUIDE工具以及callback函數(shù)實(shí)現(xiàn)相應(yīng)函數(shù)的窗口化,/functionvararg?utUNTI
6、TLEDM-fileUNTITLED,bysingleton*.=untitled(varargin)”foruntitled.fig/itself,createsanewUNTITLEDorraisestheexistingH=UNTITLED_*returnsthehandleanewUNTITLEDorthehandletotheexisting1.05singleton*.UNTITLED(CALLBACK,local,hObject,eventData,handles,.)callsthe1.41111functionnamedCALLBACKi1n1UNTITLED.MWithth
7、egivenTinputarguments.%UNTITLED(Property,Valuecreatesanewun丄丄丄ledorraisestheexistingsingleton*.Startingfromtheleft,propertyvaluepairsareappliedtotheGUIbeforeuntitled_OpeningFcngetscalled.Anunrecognizedpropertynameorinvalidvaluemakespropertyapplication%stop.Allinputsarepassedtountitled_OpeningFcnviav
8、arargin.%*SeeGUIOptionsonGUIDEsToolsmenu.ChooseGUIallowsonlyoneinstancetorun(singleton)%Seealso:GUIDE,GUIDATA,GUIHANDLES%Edittheabovetexttomodifytheresponsetohelpuntitled%LastModifiedbyGUIDEv2.515-Sep-201122:24:48ifnargoutBegininitializationcode-DOgui_Singleton=1;gui_StateNOTEDIT=struct(gui_Name,gui
9、_Singleton,gui_OpeningFcn,gui_OutputFcn,gui_LayoutFcn,gui_Callback,&ischar(varargin1)mfilename,.gui_Singleton,.untitled_OpeningFcn,.untitled_OutputFcn,.,.);ifnargingui_State.gui_Callback=str2func(varargin1);endvarargout1:nargout=gui_mainfcn(gui_State,varargin:);elsegui_mainfcn(gui_State,varargin:);e
10、nd%Endinitializationcode-DONOTEDIT%-Executesjustbeforeuntitledismadevisible.functionuntitled_OpeningFcn(hObject,eventdata,handles,varargin)%Thisfunctionhasnooutputargs,seeOutputFcn.%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(see
11、GUIDATA)%varargincommandlineargumentstountitled(seeVARARGIN)%Choosedefaultcommandlineoutputforuntitledhandles.output=hObject;%Updatehandlesstructureguidata(hObject,handles);%UIWAITmakesuntitledwaitforuserresponse(seeUIRESUME)%uiwait(handles.figure1);%-Outputsfromthisfunctionarereturnedtothecommandli
12、ne.functionvarargout=untitled_OutputFcn(hObject,eventdata,handles)%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Getdefaultcommandlineoutputfromhandlesstructurevar
13、argout1=handles.output;functionedit1_Callback(hObject,eventdata,handles)%hObjecthandletoedit1(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Hints:get(hObject,String)returnscontentsofedit1astext%str2double(get(hObject,String)returnsc
14、ontentsofedit1asadoubleguidata(hObject,handles);%-Executesduringobjectcreation,aftersettingallproperties.functionedit1_CreateFcn(hObject,eventdata,handles)%hObjecthandletoedit1(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled%
15、Hint:editcontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.ifispc&isequal(get(hObject,BackgroundColor),get(0,defaultUicontrolBackgroundColor)set(hObject,BackgroundColor,white);endfunctionedit2_Callback(hObject,eventdata,handles)%hObjecthandletoedit2(seeGCBO)%eventdatareserved-tobedefi
16、nedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Hints:get(hObject,String)returnscontentsofedit2astext%str2double(get(hObject,String)returnscontentsofedit2asadoubleguidata(hObject,handles);%-Executesduringobjectcreation,aftersettingallproperties.functionedit2_CreateFcn(
17、hObject,eventdata,handles)%hObjecthandletoedit2(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled%Hint:editcontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.ifispc&isequal(get(hObject,BackgroundColor),get(0,defau
18、ltUicontrolBackgroundColor)set(hObject,BackgroundColor,white);endfunctionedit3_Callback(hObject,eventdata,handles)%hObjecthandletoedit3(seeGCBO)%eventdatareservedtobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Hints:get(hObject,String)returnscontentsofedit3aste
19、xt%str2double(get(hObject,String)returnscontentsofedit3asadoubleguidata(hObject,handles);%-Executesduringobjectcreation,aftersettingallproperties.functionedit3_CreateFcn(hObject,eventdata,handles)%hObjecthandletoedit3(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesempty-handle
20、snotcreateduntilafterallCreateFcnscalled%Hint:editcontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.ifispc&isequal(get(hObject,BackgroundColor),get(0,defaultUicontrolBackgroundColor)set(hObject,BackgroundColor,white);endfunctionedit4_Callback(hObject,eventdata,handles)%hObjecthandleto
21、edit4(seeGCBO)%eventdatareservedtobedefinedinafutureversionofMATLAB%eventdatareservedtobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Hints:get(hObject,String)returnscontentsofedit4astext%str2double(get(hObject,
22、String)returnscontentsofedit4asadouble%-Executesduringobjectcreation,aftersettingallproperties.functionedit4_CreateFcn(hObject,eventdata,handles)%hObjecthandletoedit4(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled%Hint:editc
23、ontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.ifispc&isequal(get(hObject,BackgroundColor),get(0,defaultUicontrolBackgroundColor)set(hObject,BackgroundColor,white);end%-Executesonbuttonpressinpushbutton1.functionpushbutton1_Callback(hObject,eventdata,handles)%hObjecthandletopushbutt
24、on1(seeGCBO)x=str2num(get(handles.edit1,string);y=str2num(get(handles.edit2,string);y_1=str2num(get(handles.edit3,string);x0=str2num(get(handles.edit5,string);symst;f=0.0;if(length(x)=length(y)if(length(y)=length(y_1)n=length(x);elsedisp(yfyp亙卩吻總亙(總?2工卩總);return;endelsedisp(xfy卩亙f總卩總:);return;endfor
25、i=1:nh=1.0;a=0.0;forj=1:nif(j=i)h=h*(t-x(j)八2/(x(i)-x(j)八2);a=a+1/(x(i)-x(j);endendf=f+h*(x(i)-t)*(2*a*y(i)-y_1(i)+y(i);endf0=subs(f,t,x0);plot(handles.poltarea,x,y,*);functionedit5_Callback(hObject,eventdata,handles)%hObjecthandletoedit5(seeGCBO)%eventdatareservedtobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Hints:get(hObject,String)returnscontentsofedit5astext%str2double(get(hObject,String)returnscontentsofedit
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 軟件測(cè)試的可用性測(cè)試要領(lǐng)試題及答案
- 數(shù)據(jù)庫(kù)表設(shè)計(jì)基本要求試題及答案
- 計(jì)算機(jī)四級(jí)軟件測(cè)試實(shí)務(wù)案例匯編試題及答案
- 嵌入式操作系統(tǒng)的選擇與實(shí)踐試題及答案
- 在大型團(tuán)隊(duì)中建立高效的文檔管理與查詢機(jī)制試題及答案
- 行政組織改革的回顧與前瞻試題及答案
- 大連小區(qū)靜默管理制度
- 娛樂(lè)會(huì)所營(yíng)銷(xiāo)管理制度
- 小學(xué)設(shè)備使用管理制度
- 冰箱生熟分離管理制度
- 山東健康集團(tuán)招聘考試真題2024
- 中國(guó)2型糖尿病運(yùn)動(dòng)治療指南(2024版)解讀 2
- 木材行業(yè)火災(zāi)事故案例
- 公安機(jī)關(guān)對(duì)旅館業(yè)培訓(xùn)
- 旱地劃龍舟課件
- 中醫(yī)院面試題及答案
- AI技術(shù)與可持續(xù)發(fā)展之間的關(guān)系及實(shí)踐
- 離婚協(xié)議兩個(gè)兒子正版(2025年版)
- 2025年廣東省出版集團(tuán)數(shù)字出版有限公司招聘筆試參考題庫(kù)含答案解析
- 光伏施工安全措施方案
- 2024湖南衡陽(yáng)縣城市和農(nóng)村建設(shè)投資有限公司招聘專業(yè)技術(shù)人員2人筆試參考題庫(kù)附帶答案詳解
評(píng)論
0/150
提交評(píng)論