matlab中mathematics+工具箱使用讲课稿_第1页
matlab中mathematics+工具箱使用讲课稿_第2页
matlab中mathematics+工具箱使用讲课稿_第3页
matlab中mathematics+工具箱使用讲课稿_第4页
matlab中mathematics+工具箱使用讲课稿_第5页
已阅读5页,还剩43页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Good is good, but better carries it.精益求精,善益求善。matlab中mathematics+工具箱使用Matlab中Mathematics工具箱使用第8章最优化方法8.1最优化非线性函数工具箱提供的Humps函数,其图像如下:函数fminbnd可求单变量函数在给定区间的局部最小点,如x=fminbnd(humps,0.3,1)x=0.6370通过设置第4个参数optimset可实现显示迭代列表,如x=fminbnd(humps,0.3,1,optimset(Display,iter)fminsearch函数求多变量函数的局部极小点。首先,创建三变量函数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(非刚性微分-代数方程)NDFs(BDFs)ode23sStiffdifferentialequations(刚性微分方程)Rosenbrockode23tModeratelystiffdifferentialequationsandDAEs(中等刚性微分方程和代数方程)Trapezoidalruleode23tbStiffdifferentialequations(刚性微分方程)TR-BDF2ode15iFullyimplicitdifferentialequations(

4、全隐式微分方程)BDFsEvaluationandExtension(赋值和延拓)YoucanusethefollowingfunctionstoevaluateandextendsolutionstoODEs.你能应用如下函数对ODE的数值解解进行赋值和延拓。FunctionDescriptiondevalEvaluatethenumericalsolutionusingtheoutputofODEsolvers(用ODE输出对数值解进行赋值)odextendExtendthesolutionofaninitialvalueproblemforanODE对ODE初值问题的解进行延拓Solve

5、rOptions(求解器选项)AnoptionsstructurecontainsnamedpropertieswhosevaluesarepassedtoODEsolvers,andwhichaffectproblemsolution.Usethesefunctionstocreate,alter,oraccessanoptionsstructure.选项结构包含署名属性,其值传递给ODE求解器以影响问题求解。用这些函数可以创建,改变和接受选项结构。Function(函数)Description(描述)odesetCreateoralteroptionsstructureforinputto

6、ODEsolver.(创建和改变选项)odegetExtractpropertiesfromoptionsstructurecreatedwithodeset.(提取属性选项)OutputFunctions(输出函数)Ifanoutputfunctionisspecified,thesolvercallsthespecifiedfunctionaftereverysuccessfulintegrationstep.YoucanuseodesettospecifyoneofthesesamplefunctionsastheOutputFcnproperty,oryoucanmodifythemt

7、ocreateyourownfunctions.如果输出函数被指定,则求解器在每步积分后调用该函数进行输出。你能够用odeset指定这些例子函数之一作为OutputFcn属性,或创建自己的函数对其进行修改。FunctionDescriptionodeplotTime-seriesplot(时间序列图形)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:对于非刚性问题求解有3个求解器。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对,它是计算y(tn)的单步求解器,只需前一步的解y(tn-1).一般说来,ode45是对大多数问题的“第一试”的最好的函数。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:并不是所有困难的问题都是刚性的,但是所有的刚性问题对于非专门为此设计的求解器来说都是困难的。SolverSyntax(求解语法)AlloftheODEsolverfunctions,exceptforode15i,shareasyntaxthatmakesiteasytotryanyofthedifferentnumericalmethods,ifitisnotapparentwhichisthemostappropriate.Toapplyadifferentmethodtothesameproblem,simplychanget

18、heODEsolverfunctionname.Thesimplestsyntax,commontoallthesolverfunctions,is求解函数调用t,y=solver(odefun,tspan,y0,options)wheresolverisoneoftheODEsolverfunctionslistedpreviously.其中,solver是如前列举的ODE求解函数Thebasicinputargumentsare举例:vanderPolEquation(Nonstiff)Thisexampleillustratesthestepsforsolvinganinitialval

19、ueODEproblem:该例说明了求解ODE初值问题的步骤:1Rewritetheproblemasasystemoffirst-orderODEs.RewritethevanderPolequation(second-order)1.把高阶方程表示为一阶方程组的等价形式。vanderPol方程(二阶)where0isascalarparameter,bymakingthesubstitutiony1=y2.Theresultingsystemoffirst-orderODEsis为标量常数。做代换,得到对应的一阶方程组2Codethesystemoffirst-orderODEs.Once

20、yourepresenttheequationasasystemoffirst-orderODEs,youcancodeitasafunctionthatanODEsolvercanuse.Thefunctionmustbeoftheform2.对一阶ODE方程组编写ODEfun函数,其形式为dydt=odefun(t,y)odefun函数程序functiondydt=vdp1(t,y)dydt=y(2);(1-y(1)2)*y(2)-y(1);3.Applyasolvertotheproblem.(调用求解函数求解)Decidewhichsolveryouwanttousetosolveth

21、eproblem.Thencallthesolverandpassitthefunctionyoucreatedtodescribethefirst-ordersystemofODEs,thetimeintervalonwhichyouwanttosolvetheproblem,andaninitialconditionvector.决定用哪个求解函数求解问题,然后调用求解器,把创建的描述方程组的函数,求解区间,和初始条件传递给求解函数。ForthevanderPolsystem,youcanuseode45ontimeinterval020withinitialvaluesy(1)=2and

22、y(2)=0.对于VanderPol系统,你可以用ode45在时间区间0,20进行积分,初值条件为y(1)=2和y(2)=0,其调用求解函数的方法为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.该例表示的是一个刚性问题。对于刚性问题,解在相对积分区间非常小的时间尺度上变化,感兴趣的解在更大的时间尺度上变化。不是专为刚性问题设计的方法在解变换缓慢的区间上是无效的,因为它用的时间步长非常小以适应分辨快速变化。Whenisincreasedto1000,thesolutiontothevanderPolequationchangesdramaticallyandexhibitsoscillatio

26、nonamuchlongertimescale.Approximatingthesolutionoftheinitialvalueproblembecomesamoredifficulttask.Becausethisparticularproblemisstiff,asolverintendedfornonstiffproblems,suchasode45,istooinefficienttobepractical.Asolversuchasode15sisintendedforsuchstiffproblems.当增加到1000,vdp方程的解急剧变化,在更大时时间尺度上展示振荡。近似初值

27、问题的解是一个困难的问题。因为这个特别的问题是刚性的,对于如ode45这样的非刚性求解器实际上是效率非常低的。象ode15s是适用于刚性问题的。Thevdp1000functionevaluatesthevanderPolsystemfromthepreviousexample,butwith=1000.vdp1000函数对的vdp方程组进行赋值。functiondydt=vdp1000(t,y)dydt=y(2);1000*(1-y(1)2)*y(2)-y(1);Nowusetheode15sfunctiontosolvetheproblemwiththeinitialconditionve

28、ctorof2;0,butatimeintervalof03000.Forscalingreasons,plotjustthefirstcomponentofy(t).现在用ods15s求解具有初值向量2;0和积分区间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、(参数vdp方程)TheprecedingsectionsshowedhowtosolvethevanderPolequationfortwodifferentvaluesoftheparameter.Inthoseexamples,thevalues=1and=1000arehard-codedintheODEfunctions.IfyouaresolvinganODEforseveraldifferentparametervalues,itmightbemoreconvenienttoincludetheparameterintheODEfunctionandassignavaluetot

30、heparametereachtimeyouruntheODEsolver.ThissectionexplainshowtodothisforthevanderPolequation.前段表示了对两个不同的参数值的vdp方程。在这些例子中,和是ODE函数中的硬编码。如果你要对若干不同的参数值求解vdp方程,在方程中引入参数,每次运行进行参数赋值将会更方便。本段说明如何求解参数型vdp.OnewaytoprovideparametervaluestotheODEfunctionistowriteaMATLABfilethatAcceptstheparametersasinputs.Contain

31、sODEfunctionasanestedfunction,internallyusingtheinputparameters.CallstheODEsolver.给ODE函数提供参数的方式是建立这样的MATLAB函数,它包含输入参数,包含作为嵌套函数的ODE函数,然后调用求解器。Thefollowingcodeillustratesthis:如下代码实现该功能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)对解进行赋值ThenumericalmethodsimplementedintheODEsolversproduceacontinuoussolutionovertheintervalofintegrationa,b.Youcanevaluatetheapproximatesolution,S(x),atanypointina,busingthefunctiondevalandthestructuresolreturnedbythesolver.

34、Forexample,ifyousolvetheproblemdescribedin“vanderPolEquation(Nonstiff)”on11bycallingode45withasingleoutputargumentsol,ODE求解器实施的数值方法产生在积分区间上的连续解,你可用函数deval和solver返回的sol结构对a,b上的任何点对近似解进行赋值。例如,如果你调用ode45求解10-11的vdp问题。sol=ode45(vdp1,020,2;0);ode45returnsthesolutionasastructure.Youcanthenevaluatetheappro

35、ximatesolutionatpointsinthevectorxint=1:5asfollows:ode45作为一个结构返回解,你能够对向量xint=1:5的点赋值近似值,其方法如下:xint=1:5;Sxint=deval(sol,xint)Thedevalfunctionisvectorized.Foravectorxint,theithcolumnofSxintapproximatesthesolutiony(xint(i).deval函数是向量化的,对于向量xint,Sxint的第列近似解EulerEquations(Nonstiff)非刚性Euler方程rigidodeillus

36、tratesthesolutionofastandardtestproblemproposedbyKroghforsolversintendedfornonstiffproblems8.TheODEsaretheEulerequationsofarigidbodywithoutexternalforces.Euler方程表示无外力的刚体运动,其方程为对应的程序如下: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下例说明如何调用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说明求解由偏微分方程有限元离散导致的ode.femlode(N)中的N控制离散化,导致的系统由N个方程构成,确省为19。Thisexampleinvolvesamassmatrix.ThesystemofODEscomesfromamethodoflinessolutionofthepartialdifferentialequation该例涉及质量矩阵。ODE方程组起源于如下偏微分方程的线方法:取定整数,取,在点偏微分方程的解表示为Herek(x)isapiecewiselinearfunctionthatis1atx

40、kand0atalltheotherxj.AGalerkindiscretizationleadstothesystemofODEs其中为分段线性函数,在点取1,其它点为0,Galerkin离散导致ODE方程组。三角矩阵和可表示为Theinitialvaluesc(0)aretakenfromtheinitialconditionforthepartialdifferentialequation.Theproblemissolvedonthetimeinterval0,.初值取偏微分方程的初值条件,在时间区间上求解问题。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.嵌套函数mass(t)赋值时间依赖质量矩阵,是常数。单击文件名或在命令行输入femlode可运行程序functionfem1ode(N)%FEM1ODEStiffproblemwithatime-dependentmassmatrixifnargin1%参数个数1,即没有参数时缺省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.其中是独立变量,是依赖变量,表示,延迟是正常数。ddesd容许延迟依赖于和。HistoryandInitialValues(历史和初值)Inaninitialvalueproblem,youseekthesolutiononanintervalt0,tfwitht0tf.TheDDEshowsthaty(t)dependsonvaluesofthesolutionattimespriortot.Inparticular,y(t0)depe

47、ndsony(t01),y(t0k).Becauseofthis,asolutionont0,tfdependsonitsvaluesfortt0,i.e.,itshistoryS(t).在初值问题中,你求区间的解。DDE表明依赖于之前的解值,特别的,依赖于。因此,在上的解依赖于历史。PropagationofDiscontinuities(间断的传播)Generally,thesolutiony(t)ofanIVPforasystemofDDEshasajumpinitsfirstderivativeattheinitialpointt0becausethefirstderivativeof

48、thehistoryfunctiondoesnotsatisfytheDDEthere.Adiscontinuityinanyderivativepropagatesintothefutureatspacingsof1,2,kwhenthedelaysareconstant,andinamorecomplicatedwaywhentheyarenot.FortheDDEssolvedbydde23andddesd,thesolutionbecomessmootherastheintegrationproceeds.一般说来,DDE的IVP的解的一阶导数在初始点有跳跃10.2Boundary-V

49、alueProblems(边值问题)BVP求解器SolverDescriptionbvp4cSolveboundaryvalueproblemsforordinarydifferentialequations.求解ODE边值问题bvp5cSolveboundaryvalueproblemsforordinarydifferentialequations.求解ODE边值问题BVPHelperFunctions(边值问题辅助函数)FunctionDescriptionbvpinitFormtheinitialguessforbvp4c.(产生求解函数bvp4c的初始猜测)devalEvaluate

50、thenumericalsolutionusingtheoutputofbvp4c.(用函数bvp4c的输出对数值解进行赋值)BVPSolverOptions(BVP求解器选项)Anoptionsstructurecontainsnamedpropertieswhosevaluesarepassedtobvp4c,andwhichaffectproblemsolution.Usethesefunctionstocreate,alter,oraccessanoptionsstructure.Functio(函数)Description(描述)bvpsetCreate/altertheBVPopt

51、ionsstructure-创建/改变BVP选项bvpgetExtractpropertiesfromoptionsstructurecreatedwithbvpset(获取选项属性).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.此时,边界条件必须足以确定p的值。这也可包括其他类

56、型的BVP问题,如:(1)含有未知参数;(2)解具有奇异性;(3)多点条件。在这种情况下,边界条件的个数必须足以确定解与未知参数。bvp4cproducesasolutionthatiscontinuousona,bandhasacontinuousfirstderivativethere.Youcanusethefunctiondevalandtheoutputofbvp4ctoevaluatethesolutionatspecificpointsontheintervalofintegration.bvp4c产生的解在a,b上连续,有连续的一阶导数,可用函数deval和bvp4c的输出对积

57、分区间内的某点的解进行赋值。bvp4cisafinitedifferencecodethatimplementsthe3-stageLobattoIIIaformula.ThisisacollocationformulaandthecollocationpolynomialprovidesaC1-continuoussolutionthatisfourth-orderaccurateuniformlyintheintervalofintegration.Meshselectionanderrorcontrolarebasedontheresidualofthecontinuoussolutio

58、n.bvp4c是有限差分代码,实施3-阶段LobattoIII公式。这是一种配置公式,配置多项式给出C1-连续解,在积分区间上具有一致4-阶精度。网格选择和误差控制是基于连续解的残差。Thecollocationtechniqueusesameshofpointstodividetheintervalofintegrationintosubintervals.Thesolverdeterminesanumericalsolutionbysolvingaglobalsystemofalgebraicequationsresultingfromtheboundaryconditions,andth

59、ecollocationconditionsimposedonallthesubintervals.Thesolverthenestimatestheerrorofthenumericalsolutiononeachsubinterval.Ifthesolutiondoesnotsatisfythetolerancecriteria,thesolveradaptsthemeshandrepeatstheprocess.Theusermustprovidethepointsoftheinitialmeshaswellasaninitialapproximationofthesolutionatt

60、hemeshpoints.配置技术用网格点把积分区间剖分为子区间。求解器通过求解由边界条件和在子区间上的配置条件得到的代数方程组得到数值解,然后在每个子区间上估计数值解的误差。如果解不满足容差标准,求解器调整网格重复以上过程。用户必须提供初始网格点和在网格点上的初始近似解。BVPSolverSyntax(BVP求解器语法)ThebasicsyntaxoftheBVPsolveris-BVP求解器的基本语法是sol=bvp4c(odefun,bcfun,solinit)Theinputargumentsare(输入参数为odefun-Handletoafunctionthatevaluatest

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论