版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、Good is good, but better carries it.精益求精,善益求善。matlab中mathematics+工具箱使用Matlab中Mathematics工具箱使用第8章最優(yōu)化方法8.1最優(yōu)化非線性函數(shù)工具箱提供的Humps函數(shù),其圖像如下:函數(shù)fminbnd可求單變量函數(shù)在給定區(qū)間的局部最小點(diǎn),如x=fminbnd(humps,0.3,1)x=0.6370通過設(shè)置第4個(gè)參數(shù)optimset可實(shí)現(xiàn)顯示迭代列表,如x=fminbnd(humps,0.3,1,optimset(Display,iter)fminsearch函數(shù)求多變量函數(shù)的局部極小點(diǎn)。首先,創(chuàng)建三變量函數(shù)th
2、ree_varb=(x)x(1)2+2.5*sin(x(2)-x(3)2*x(1)2*x(2)2a=fminsearch(b,-0.6,-1.2,0.135)0.0000-1.57080.1803第10章微積分ODE求解器Solver(求解器)SolvesTheseKindsofProblems(求解問題)Method(方法)ode45Nonstiffdifferentialequations(非剛性微分方程)Runge-Kuttaode23Nonstiffdifferentialequations(非剛性微分方程)Runge-Kuttaode113Nonstiffdifferentialeq
3、uations(非剛性微分方程)Adamsode15sStiffdifferentialequationsandDAEs(非剛性微分-代數(shù)方程)NDFs(BDFs)ode23sStiffdifferentialequations(剛性微分方程)Rosenbrockode23tModeratelystiffdifferentialequationsandDAEs(中等剛性微分方程和代數(shù)方程)Trapezoidalruleode23tbStiffdifferentialequations(剛性微分方程)TR-BDF2ode15iFullyimplicitdifferentialequations(
4、全隱式微分方程)BDFsEvaluationandExtension(賦值和延拓)YoucanusethefollowingfunctionstoevaluateandextendsolutionstoODEs.你能應(yīng)用如下函數(shù)對(duì)ODE的數(shù)值解解進(jìn)行賦值和延拓。FunctionDescriptiondevalEvaluatethenumericalsolutionusingtheoutputofODEsolvers(用ODE輸出對(duì)數(shù)值解進(jìn)行賦值)odextendExtendthesolutionofaninitialvalueproblemforanODE對(duì)ODE初值問題的解進(jìn)行延拓Solve
5、rOptions(求解器選項(xiàng))AnoptionsstructurecontainsnamedpropertieswhosevaluesarepassedtoODEsolvers,andwhichaffectproblemsolution.Usethesefunctionstocreate,alter,oraccessanoptionsstructure.選項(xiàng)結(jié)構(gòu)包含署名屬性,其值傳遞給ODE求解器以影響問題求解。用這些函數(shù)可以創(chuàng)建,改變和接受選項(xiàng)結(jié)構(gòu)。Function(函數(shù))Description(描述)odesetCreateoralteroptionsstructureforinputto
6、ODEsolver.(創(chuàng)建和改變選項(xiàng))odegetExtractpropertiesfromoptionsstructurecreatedwithodeset.(提取屬性選項(xiàng))OutputFunctions(輸出函數(shù))Ifanoutputfunctionisspecified,thesolvercallsthespecifiedfunctionaftereverysuccessfulintegrationstep.YoucanuseodesettospecifyoneofthesesamplefunctionsastheOutputFcnproperty,oryoucanmodifythemt
7、ocreateyourownfunctions.如果輸出函數(shù)被指定,則求解器在每步積分后調(diào)用該函數(shù)進(jìn)行輸出。你能夠用odeset指定這些例子函數(shù)之一作為OutputFcn屬性,或創(chuàng)建自己的函數(shù)對(duì)其進(jìn)行修改。FunctionDescriptionodeplotTime-seriesplot(時(shí)間序列圖形)odephas2Two-dimensionalphaseplaneplot(2-維相平面圖形)odephas3Three-dimensionalphaseplaneplot(3-維相平面圖形)odeprintPrinttocommandwindow(打印到命令窗)FirstOrderODEs(一
8、階ODEs)Anordinarydifferentialequation(ODE)containsoneormorederivativesofadependentvariableywithrespecttoasingleindependentvariablet,usuallyreferredtoastime.Thederivativeofywithrespecttotisdenotedasy,thesecondderivativeasy,andsoon.Ofteny(t)isavector,havingelementsy1,y2,.,yn.MATLABsolvershandlethefollo
9、wingtypesoffirst-orderODEs:ExplicitODEsoftheformy=f(t,y)形如y=f(t,y)的顯式ODEsLinearlyimplicitODEsoftheformM(t,y)y=f(t,y),whereM(t,y)isamatrix形如M(t,y)y=f(t,y)的線性隱式ODEsFullyimplicitODEsoftheformf(t,y,y)=0(ode15ionly):形如f(t,y,y)=0的全隱式ODEsHigherOrderODEs(高階ODEs)MATLABODEsolversacceptonlyfirst-orderdifferent
10、ialequations.Tousethesolverswithhigher-orderODEs,youmustrewriteeachequationasanequivalentsystemoffirst-orderdifferentialequationsoftheformy=f(t,y)Youcanwriteanyordinarydifferentialequationy(n)=f(t,y,y,.,y(n1)asasystemoffirst-orderequationsbymakingthesubstitutionsy1=y,y2=y,.,yn=y(n1)y1=y,y2=y,.,yn=y(
11、n1)Theresultisanequivalentsystemofnfirst-orderODEs.Rewritethesecond-ordervanderPolequationasasystemoffirst-orderODEs.InitialValues(初值問題)Generallytherearemanyfunctionsy(t)thatsatisfyagivenODE,andadditionalinformationisnecessarytospecifythesolutionofinterest.Inaninitialvalueproblem,thesolutionofintere
12、stsatisfiesaspecificinitialcondition,thatis,yisequaltoy0atagiveninitialtimet0.AninitialvalueproblemforanODEisthenIfthefunctionf(t,y)issufficientlysmooth,thisproblemhasoneandonlyonesolution.Generallythereisnoanalyticexpressionforthesolution,soitisnecessarytoapproximatey(t)bynumericalmeans.NonstiffPro
13、blems(剛性問題)Therearethreesolversdesignedfornonstiffproblems:對(duì)于非剛性問題求解有3個(gè)求解器。ode45BasedonanexplicitRunge-Kutta(4,5)formula,theDormand-Princepair.Itisaone-stepsolverincomputingy(tn),itneedsonlythesolutionattheimmediatelyprecedingtimepoint,y(tn1).Ingeneral,ode45isthebestfunctiontoapplyasa“firsttry”formo
14、stproblems.ode45基于顯式Runge-Kutta(4,5)公式,Dormand-Prince對(duì),它是計(jì)算y(tn)的單步求解器,只需前一步的解y(tn-1).一般說來,ode45是對(duì)大多數(shù)問題的“第一試”的最好的函數(shù)。ode23BasedonanexplicitRunge-Kutta(2,3)pairofBogackiandShampine.Itmaybemoreefficientthanode45atcrudetolerancesandinthepresenceofmildstiffness.Likeode45,ode23isaone-stepsolver.ode113Vari
15、ableorderAdams-Bashforth-MoultonPECEsolver.Itmaybemoreefficientthanode45atstringenttolerancesandwhentheODEfunctionisparticularlyexpensivetoevaluate.ode113isamultistepsolveritnormallyneedsthesolutionsatseveralprecedingtimepointstocomputethecurrentsolution.StiffProblems(剛性問題)Notalldifficultproblemsare
16、stiff,butallstiffproblemsaredifficultforsolversnotspecificallydesignedforthem.Solversforstiffproblemscanbeusedexactlyliketheothersolvers.However,youcanoftensignificantlyimprovetheefficiencyofthesesolversbyprovidingthemwithadditionalinformationabouttheproblem.(See“IntegratorOptions”on9.)Therearefours
17、olversdesignedforstiffproblems:并不是所有困難的問題都是剛性的,但是所有的剛性問題對(duì)于非專門為此設(shè)計(jì)的求解器來說都是困難的。SolverSyntax(求解語法)AlloftheODEsolverfunctions,exceptforode15i,shareasyntaxthatmakesiteasytotryanyofthedifferentnumericalmethods,ifitisnotapparentwhichisthemostappropriate.Toapplyadifferentmethodtothesameproblem,simplychanget
18、heODEsolverfunctionname.Thesimplestsyntax,commontoallthesolverfunctions,is求解函數(shù)調(diào)用t,y=solver(odefun,tspan,y0,options)wheresolverisoneoftheODEsolverfunctionslistedpreviously.其中,solver是如前列舉的ODE求解函數(shù)Thebasicinputargumentsare舉例:vanderPolEquation(Nonstiff)Thisexampleillustratesthestepsforsolvinganinitialval
19、ueODEproblem:該例說明了求解ODE初值問題的步驟:1Rewritetheproblemasasystemoffirst-orderODEs.RewritethevanderPolequation(second-order)1.把高階方程表示為一階方程組的等價(jià)形式。vanderPol方程(二階)where0isascalarparameter,bymakingthesubstitutiony1=y2.Theresultingsystemoffirst-orderODEsis為標(biāo)量常數(shù)。做代換,得到對(duì)應(yīng)的一階方程組2Codethesystemoffirst-orderODEs.Once
20、yourepresenttheequationasasystemoffirst-orderODEs,youcancodeitasafunctionthatanODEsolvercanuse.Thefunctionmustbeoftheform2.對(duì)一階ODE方程組編寫ODEfun函數(shù),其形式為dydt=odefun(t,y)odefun函數(shù)程序functiondydt=vdp1(t,y)dydt=y(2);(1-y(1)2)*y(2)-y(1);3.Applyasolvertotheproblem.(調(diào)用求解函數(shù)求解)Decidewhichsolveryouwanttousetosolveth
21、eproblem.Thencallthesolverandpassitthefunctionyoucreatedtodescribethefirst-ordersystemofODEs,thetimeintervalonwhichyouwanttosolvetheproblem,andaninitialconditionvector.決定用哪個(gè)求解函數(shù)求解問題,然后調(diào)用求解器,把創(chuàng)建的描述方程組的函數(shù),求解區(qū)間,和初始條件傳遞給求解函數(shù)。ForthevanderPolsystem,youcanuseode45ontimeinterval020withinitialvaluesy(1)=2and
22、y(2)=0.對(duì)于VanderPol系統(tǒng),你可以用ode45在時(shí)間區(qū)間0,20進(jìn)行積分,初值條件為y(1)=2和y(2)=0,其調(diào)用求解函數(shù)的方法為t,y=ode45(vdp1,020,2;0);4Viewthesolveroutput.Youcansimplyusetheplotcommandtoviewthesolveroutput.4.視圖求解輸出。你能夠用plot命令視圖解輸出。plot(t,y(:,1),-,t,y(:,2),-)title(SolutionofvanderPolEquation,mu=1);xlabel(timet);ylabel(solutiony);legend
23、(y_1,y_2)Asanalternative,youcanuseasolveroutputfunctiontoprocesstheoutput.ThesolvercallsthefunctionspecifiedintheintegrationpropertyOutputFcnaftereachsuccessfultimestep.UseodesettosetOutputFcntothedesiredfunction.SeeSolverOutputProperties,inthereferencepageforodeset,formoreinformationaboutOutputFcn.
24、作為選擇,你能夠用求解器輸出處理輸出。vanderPolEquation(Stiff)(剛性vanderPol方程)Thisexamplepresentsastiffproblem.Forastiffproblem,solutionscanchangeonatimescalethatisveryshortcomparedtotheintervalofintegration,butthesolutionofinterestchangesonamuchlongertimescale.Methodsnotdesignedforstiffproblemsareineffectiveoninterval
25、swherethesolutionchangesslowlybecausetheyusetimestepssmallenoughtoresolvethefastestpossiblechange.該例表示的是一個(gè)剛性問題。對(duì)于剛性問題,解在相對(duì)積分區(qū)間非常小的時(shí)間尺度上變化,感興趣的解在更大的時(shí)間尺度上變化。不是專為剛性問題設(shè)計(jì)的方法在解變換緩慢的區(qū)間上是無效的,因?yàn)樗玫臅r(shí)間步長非常小以適應(yīng)分辨快速變化。Whenisincreasedto1000,thesolutiontothevanderPolequationchangesdramaticallyandexhibitsoscillatio
26、nonamuchlongertimescale.Approximatingthesolutionoftheinitialvalueproblembecomesamoredifficulttask.Becausethisparticularproblemisstiff,asolverintendedfornonstiffproblems,suchasode45,istooinefficienttobepractical.Asolversuchasode15sisintendedforsuchstiffproblems.當(dāng)增加到1000,vdp方程的解急劇變化,在更大時(shí)時(shí)間尺度上展示振蕩。近似初值
27、問題的解是一個(gè)困難的問題。因?yàn)檫@個(gè)特別的問題是剛性的,對(duì)于如ode45這樣的非剛性求解器實(shí)際上是效率非常低的。象ode15s是適用于剛性問題的。Thevdp1000functionevaluatesthevanderPolsystemfromthepreviousexample,butwith=1000.vdp1000函數(shù)對(duì)的vdp方程組進(jìn)行賦值。functiondydt=vdp1000(t,y)dydt=y(2);1000*(1-y(1)2)*y(2)-y(1);Nowusetheode15sfunctiontosolvetheproblemwiththeinitialconditionve
28、ctorof2;0,butatimeintervalof03000.Forscalingreasons,plotjustthefirstcomponentofy(t).現(xiàn)在用ods15s求解具有初值向量2;0和積分區(qū)間0,3000上的初值問題。為尺度原因,僅畫出的第一分量。t,y=ode15s(vdp1000,03000,2;0);plot(t,y(:,1),-);title(SolutionofvanderPolEquation,mu=1000);xlabel(timet);ylabel(solutiony_1);vanderPolEquation(ParameterizingtheODE)
29、(參數(shù)vdp方程)TheprecedingsectionsshowedhowtosolvethevanderPolequationfortwodifferentvaluesoftheparameter.Inthoseexamples,thevalues=1and=1000arehard-codedintheODEfunctions.IfyouaresolvinganODEforseveraldifferentparametervalues,itmightbemoreconvenienttoincludetheparameterintheODEfunctionandassignavaluetot
30、heparametereachtimeyouruntheODEsolver.ThissectionexplainshowtodothisforthevanderPolequation.前段表示了對(duì)兩個(gè)不同的參數(shù)值的vdp方程。在這些例子中,和是ODE函數(shù)中的硬編碼。如果你要對(duì)若干不同的參數(shù)值求解vdp方程,在方程中引入?yún)?shù),每次運(yùn)行進(jìn)行參數(shù)賦值將會(huì)更方便。本段說明如何求解參數(shù)型vdp.OnewaytoprovideparametervaluestotheODEfunctionistowriteaMATLABfilethatAcceptstheparametersasinputs.Contain
31、sODEfunctionasanestedfunction,internallyusingtheinputparameters.CallstheODEsolver.給ODE函數(shù)提供參數(shù)的方式是建立這樣的MATLAB函數(shù),它包含輸入?yún)?shù),包含作為嵌套函數(shù)的ODE函數(shù),然后調(diào)用求解器。Thefollowingcodeillustratesthis:如下代碼實(shí)現(xiàn)該功能functiont,y=solve_vdp(mu)tspan=0max(20,3*mu);y0=2;0;%CalltheODEsolverode15s.t,y=ode15s(vdp,tspan,y0);%DefinetheODEfunc
32、tionasnestedfunction,%usingtheparametermu.functiondydt=vdp(t,y)dydt=y(2);mu*(1-y(1)2)*y(2)-y(1);endendBecausetheODEfunctionvdpisanestedfunction,thevalueoftheparametermuisavailabletoit.ToruntheMATLABfileformu=1,entert,y=solve_vdp(1);Torunthecodefor=1000,entert,y=solve_vdp(1000);Seethevdpodecodeforaco
33、mpleteexamplebasedonthesefunctions.vanderPolEquation(EvaluatingtheSolution)對(duì)解進(jìn)行賦值ThenumericalmethodsimplementedintheODEsolversproduceacontinuoussolutionovertheintervalofintegrationa,b.Youcanevaluatetheapproximatesolution,S(x),atanypointina,busingthefunctiondevalandthestructuresolreturnedbythesolver.
34、Forexample,ifyousolvetheproblemdescribedin“vanderPolEquation(Nonstiff)”on11bycallingode45withasingleoutputargumentsol,ODE求解器實(shí)施的數(shù)值方法產(chǎn)生在積分區(qū)間上的連續(xù)解,你可用函數(shù)deval和solver返回的sol結(jié)構(gòu)對(duì)a,b上的任何點(diǎn)對(duì)近似解進(jìn)行賦值。例如,如果你調(diào)用ode45求解10-11的vdp問題。sol=ode45(vdp1,020,2;0);ode45returnsthesolutionasastructure.Youcanthenevaluatetheappro
35、ximatesolutionatpointsinthevectorxint=1:5asfollows:ode45作為一個(gè)結(jié)構(gòu)返回解,你能夠?qū)ο蛄縳int=1:5的點(diǎn)賦值近似值,其方法如下:xint=1:5;Sxint=deval(sol,xint)Thedevalfunctionisvectorized.Foravectorxint,theithcolumnofSxintapproximatesthesolutiony(xint(i).deval函數(shù)是向量化的,對(duì)于向量xint,Sxint的第列近似解EulerEquations(Nonstiff)非剛性Euler方程rigidodeillus
36、tratesthesolutionofastandardtestproblemproposedbyKroghforsolversintendedfornonstiffproblems8.TheODEsaretheEulerequationsofarigidbodywithoutexternalforces.Euler方程表示無外力的剛體運(yùn)動(dòng),其方程為對(duì)應(yīng)的程序如下:functionrigidode%RIGIDODEEulerequations:rigidbodywithoutexternalforcestspan=012;y0=0;1;1;%Solvetheproblemusingode45o
37、de45(f,tspan,y0);%functiondydt=f(t,y)dydt=y(2)*y(3)-y(1)*y(3)-0.51*y(1)*y(2);FullyImplicitODE(全隱式ODE)Thefollowingexampleshowshowtousethefunctionode15itosolvetheimplicitODEproblemdefinedbyWeissingersequation下例說明如何調(diào)用ode15i求解隱ODE問題。初值為,精確解為。t0=1;y0=sqrt(3/2);yp0=0;y0,yp0=decic(weissinger,t0,y0,1,yp0,0)
38、;t,y=ode15i(weissinger,110,y0,yp0);ytrue=sqrt(t.2+0.5);plot(t,y,t,ytrue,o);FiniteElementDiscretization(有限元離散)fem1odeillustratesthesolutionofODEsthatresultfromafiniteelementdiscretizationofapartialdifferentialequation.ThevalueofNinthecallfem1ode(N)controlsthediscretization,andtheresultingsystemconsis
39、tsofNequations.Bydefault,Nis19.femlode說明求解由偏微分方程有限元離散導(dǎo)致的ode.femlode(N)中的N控制離散化,導(dǎo)致的系統(tǒng)由N個(gè)方程構(gòu)成,確省為19。Thisexampleinvolvesamassmatrix.ThesystemofODEscomesfromamethodoflinessolutionofthepartialdifferentialequation該例涉及質(zhì)量矩陣。ODE方程組起源于如下偏微分方程的線方法:取定整數(shù),取,在點(diǎn)偏微分方程的解表示為Herek(x)isapiecewiselinearfunctionthatis1atx
40、kand0atalltheotherxj.AGalerkindiscretizationleadstothesystemofODEs其中為分段線性函數(shù),在點(diǎn)取1,其它點(diǎn)為0,Galerkin離散導(dǎo)致ODE方程組。三角矩陣和可表示為Theinitialvaluesc(0)aretakenfromtheinitialconditionforthepartialdifferentialequation.Theproblemissolvedonthetimeinterval0,.初值取偏微分方程的初值條件,在時(shí)間區(qū)間上求解問題。Inthefem1odeexample,theproperties(在fe
41、mlode例子中,屬性options=odeset(Mass,mass,MStateDep,none,Jacobian,J)表明問題具有的形式,indicatethattheproblemisoftheformM(t)y=Jy.Thenestedfunctionmass(t)evaluatesthetime-dependentmassmatrixM(t)andJistheconstantJacobian.Torunthisexample,clicktheexamplename,ortypefem1odeatthecommandline.Fromthecommandline,youcanspec
42、ifyavalueofNasanargumenttofem1ode.ThedefaultisN=19.嵌套函數(shù)mass(t)賦值時(shí)間依賴質(zhì)量矩陣,是常數(shù)。單擊文件名或在命令行輸入femlode可運(yùn)行程序functionfem1ode(N)%FEM1ODEStiffproblemwithatime-dependentmassmatrixifnargin1%參數(shù)個(gè)數(shù)1,即沒有參數(shù)時(shí)缺省19.N=19;endh=pi/(N+1);y0=sin(h*(1:N);tspan=0;pi;%TheJacobianisconstant.e=repmat(1/h,N,1);%e=(1/h).(1/h);d=re
43、pmat(-2/h,N,1);%d=(-2/h).(-2/h);%Jissharedwiththederivativefunction.J=spdiags(ede,-1:1,N,N);d=repmat(h/6,N,1);%Missharedwiththemassmatrixfunction.M=spdiags(d4*dd,-1:1,N,N);options=odeset(Mass,mass,MStateDep,none,.Jacobian,J);t,y=ode15s(f,tspan,y0,options);figure;surf(1:N)/(N+1),t,y);set(gca,ZLim,01)
44、;view(142.5,30);title(Finiteelementproblemwithtime-dependentmass.matrix,solvedbyODE15S);xlabel(space(x/pi);ylabel(time);zlabel(solution);%functionyp=f(t,y)%Derivativefunction.yp=J*y;%ConstantJacobianprovidedbyouterfunctionend%Endnestedfunctionf%functionMt=mass(t)%Massmatrixfunction.Mt=exp(-t)*M;%Mis
45、providedbyouterfunctionend%Endnestedfunctionmass%endDelayDifferentialEquations(延遲微分方程)InitialValueProblemsTheDDEdde23solvercansolvesystemsofordinarydifferentialequations,suchasdde23求解如下延遲微分方程組wheretistheindependentvariable,yisthedependentvariable,andyrepresents(derivativeofywithrespecttot)dy/dt.Thed
46、elays(lags)1,karepositiveconstants.Thesolverddesdallowsdelaysthatdependontandy.其中是獨(dú)立變量,是依賴變量,表示,延遲是正常數(shù)。ddesd容許延遲依賴于和。HistoryandInitialValues(歷史和初值)Inaninitialvalueproblem,youseekthesolutiononanintervalt0,tfwitht0tf.TheDDEshowsthaty(t)dependsonvaluesofthesolutionattimespriortot.Inparticular,y(t0)depe
47、ndsony(t01),y(t0k).Becauseofthis,asolutionont0,tfdependsonitsvaluesfortt0,i.e.,itshistoryS(t).在初值問題中,你求區(qū)間的解。DDE表明依賴于之前的解值,特別的,依賴于。因此,在上的解依賴于歷史。PropagationofDiscontinuities(間斷的傳播)Generally,thesolutiony(t)ofanIVPforasystemofDDEshasajumpinitsfirstderivativeattheinitialpointt0becausethefirstderivativeof
48、thehistoryfunctiondoesnotsatisfytheDDEthere.Adiscontinuityinanyderivativepropagatesintothefutureatspacingsof1,2,kwhenthedelaysareconstant,andinamorecomplicatedwaywhentheyarenot.FortheDDEssolvedbydde23andddesd,thesolutionbecomessmootherastheintegrationproceeds.一般說來,DDE的IVP的解的一階導(dǎo)數(shù)在初始點(diǎn)有跳躍10.2Boundary-V
49、alueProblems(邊值問題)BVP求解器SolverDescriptionbvp4cSolveboundaryvalueproblemsforordinarydifferentialequations.求解ODE邊值問題bvp5cSolveboundaryvalueproblemsforordinarydifferentialequations.求解ODE邊值問題BVPHelperFunctions(邊值問題輔助函數(shù))FunctionDescriptionbvpinitFormtheinitialguessforbvp4c.(產(chǎn)生求解函數(shù)bvp4c的初始猜測)devalEvaluate
50、thenumericalsolutionusingtheoutputofbvp4c.(用函數(shù)bvp4c的輸出對(duì)數(shù)值解進(jìn)行賦值)BVPSolverOptions(BVP求解器選項(xiàng))Anoptionsstructurecontainsnamedpropertieswhosevaluesarepassedtobvp4c,andwhichaffectproblemsolution.Usethesefunctionstocreate,alter,oraccessanoptionsstructure.Functio(函數(shù))Description(描述)bvpsetCreate/altertheBVPopt
51、ionsstructure-創(chuàng)建/改變BVP選項(xiàng)bvpgetExtractpropertiesfromoptionsstructurecreatedwithbvpset(獲取選項(xiàng)屬性).BoundaryValueProblemsTheBVPsolverisdesignedtohandlesystemsofordinarydifferentialequationsy=f(x,y)wherexistheindependentvariable,yisthedependentvariable,andyrepresentsthederivativeofywithrespecttoxdy/dx.Bound
52、aryConditionsInaboundaryvalueproblem,thesolutionofinterestsatisfiescertainboundaryconditions.Theseconditionsspecifyarelationshipbetweenthevaluesofthesolutionatmorethanonex.Initsbasicsyntax,bvp4cisdesignedtosolvetwo-pointBVPs,i.e.,problemswherethesolutionsoughtonanintervala,bmustsatisfytheboundarycon
53、ditionsg(y(a),y(b)=0Unlikeinitialvalueproblems,aboundaryvalueproblemmaynothaveasolution,mayhaveafinitenumberofsolutions,ormayhaveinfinitelymanysolutions.AsanintegralpartoftheprocessofsolvingaBVP,youneedtoprovideaguessfortherequiredsolution.Thequalityofthisguesscanbecriticalforthesolverperformanceand
54、evenforasuccessfulcomputation.TheremaybeotherdifficultieswhensolvingBVPs,suchasproblemsimposedoninfiniteintervalsorproblemsthatinvolvesingularcoefficients.OftenBVPsinvolveunknownparameterspthathavetobedeterminedaspartofsolvingtheproblemy=f(x,y,p)g(y(a),y(b),p)=0Inthiscase,theboundaryconditionsmustsu
55、fficetodeterminethevalueofp.ItcanalsoaccommodateothertypesofBVPproblems,suchasthosethathaveanyofthefollowing:UnknownparametersSingularitiesinthesolutionsMultipointconditionsInthiscase,thenumberofboundaryconditionsmustbesufficienttodeterminethesolutionandtheunknownparameters.此時(shí),邊界條件必須足以確定p的值。這也可包括其他類
56、型的BVP問題,如:(1)含有未知參數(shù);(2)解具有奇異性;(3)多點(diǎn)條件。在這種情況下,邊界條件的個(gè)數(shù)必須足以確定解與未知參數(shù)。bvp4cproducesasolutionthatiscontinuousona,bandhasacontinuousfirstderivativethere.Youcanusethefunctiondevalandtheoutputofbvp4ctoevaluatethesolutionatspecificpointsontheintervalofintegration.bvp4c產(chǎn)生的解在a,b上連續(xù),有連續(xù)的一階導(dǎo)數(shù),可用函數(shù)deval和bvp4c的輸出對(duì)積
57、分區(qū)間內(nèi)的某點(diǎn)的解進(jìn)行賦值。bvp4cisafinitedifferencecodethatimplementsthe3-stageLobattoIIIaformula.ThisisacollocationformulaandthecollocationpolynomialprovidesaC1-continuoussolutionthatisfourth-orderaccurateuniformlyintheintervalofintegration.Meshselectionanderrorcontrolarebasedontheresidualofthecontinuoussolutio
58、n.bvp4c是有限差分代碼,實(shí)施3-階段LobattoIII公式。這是一種配置公式,配置多項(xiàng)式給出C1-連續(xù)解,在積分區(qū)間上具有一致4-階精度。網(wǎng)格選擇和誤差控制是基于連續(xù)解的殘差。Thecollocationtechniqueusesameshofpointstodividetheintervalofintegrationintosubintervals.Thesolverdeterminesanumericalsolutionbysolvingaglobalsystemofalgebraicequationsresultingfromtheboundaryconditions,andth
59、ecollocationconditionsimposedonallthesubintervals.Thesolverthenestimatestheerrorofthenumericalsolutiononeachsubinterval.Ifthesolutiondoesnotsatisfythetolerancecriteria,thesolveradaptsthemeshandrepeatstheprocess.Theusermustprovidethepointsoftheinitialmeshaswellasaninitialapproximationofthesolutionatt
60、hemeshpoints.配置技術(shù)用網(wǎng)格點(diǎn)把積分區(qū)間剖分為子區(qū)間。求解器通過求解由邊界條件和在子區(qū)間上的配置條件得到的代數(shù)方程組得到數(shù)值解,然后在每個(gè)子區(qū)間上估計(jì)數(shù)值解的誤差。如果解不滿足容差標(biāo)準(zhǔn),求解器調(diào)整網(wǎng)格重復(fù)以上過程。用戶必須提供初始網(wǎng)格點(diǎn)和在網(wǎng)格點(diǎn)上的初始近似解。BVPSolverSyntax(BVP求解器語法)ThebasicsyntaxoftheBVPsolveris-BVP求解器的基本語法是sol=bvp4c(odefun,bcfun,solinit)Theinputargumentsare(輸入?yún)?shù)為odefun-Handletoafunctionthatevaluatest
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 企業(yè)獨(dú)棟總部出售合同范例
- 簽約合同范例
- 勞務(wù)派遣進(jìn)廠合同范例
- 2025簡單版重慶購房合同
- 工程預(yù)算施工合同范例
- 勞務(wù)總包大合同范例
- 土地簽約合同范例
- 橋梁木工班組勞務(wù)合同范例
- 快速簽約洽談合同范例
- 銅仁職業(yè)技術(shù)學(xué)院《地震地質(zhì)綜合解釋》2023-2024學(xué)年第一學(xué)期期末試卷
- 2024年黑龍江省龍東地區(qū)中考數(shù)學(xué)試題含答案
- 劉潤年度演講2024
- 2024秋期國家開放大學(xué)《政治學(xué)原理》一平臺(tái)在線形考(形考任務(wù)四)試題及答案
- 小學(xué)生講海軍司令肖勁光的紅色故事肖勁光先進(jìn)事跡學(xué)習(xí)
- 養(yǎng)老院的經(jīng)營規(guī)劃方案
- TSG51-2023起重機(jī)械安全技術(shù)規(guī)程
- 人教版英語初二上學(xué)期試題及答案指導(dǎo)(2024年)
- 餐飲管理招聘面試題與參考回答(某大型央企)
- 期末+(試題)+-2024-2025學(xué)年譯林版(三起)(2024)英語三年級(jí)上冊(cè)
- 2023年農(nóng)機(jī)專業(yè)合作社調(diào)研報(bào)告(五篇)
- 2024年秋季新人教版七年級(jí)上冊(cè)地理全冊(cè)導(dǎo)學(xué)案(2024年新教材)
評(píng)論
0/150
提交評(píng)論