中mathematics工具箱使用Word格式文档下载.docx

上传人:b****5 文档编号:18787338 上传时间:2023-01-01 格式:DOCX 页数:22 大小:116.43KB
下载 相关 举报
中mathematics工具箱使用Word格式文档下载.docx_第1页
第1页 / 共22页
中mathematics工具箱使用Word格式文档下载.docx_第2页
第2页 / 共22页
中mathematics工具箱使用Word格式文档下载.docx_第3页
第3页 / 共22页
中mathematics工具箱使用Word格式文档下载.docx_第4页
第4页 / 共22页
中mathematics工具箱使用Word格式文档下载.docx_第5页
第5页 / 共22页
点击查看更多>>
下载资源
资源描述

中mathematics工具箱使用Word格式文档下载.docx

《中mathematics工具箱使用Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《中mathematics工具箱使用Word格式文档下载.docx(22页珍藏版)》请在冰豆网上搜索。

中mathematics工具箱使用Word格式文档下载.docx

SolvesTheseKindsofProblems(求解问题)

Method(方法)

ode45

Nonstiffdifferentialequations(非刚性微分方程)

Runge-Kutta

ode23

ode113

Nonstiffdifferentialequations(非刚性微分方程)

Adams

ode15s

StiffdifferentialequationsandDAEs(非刚性微分-代数方程)

NDFs(BDFs)

ode23s

Stiffdifferentialequations(刚性微分方程)

Rosenbrock

ode23t

ModeratelystiffdifferentialequationsandDAEs

(中等刚性微分方程和代数方程)

Trapezoidalrule

ode23tb

Stiffdifferentialequations(刚性微分方程)

TR-BDF2

ode15i

Fullyimplicitdifferentialequations(全隐式微分方程)

BDFs

EvaluationandExtension(赋值和延拓)

YoucanusethefollowingfunctionstoevaluateandextendsolutionstoODEs.

你能应用如下函数对ODE的数值解解进行赋值和延拓。

Function

Description

deval

EvaluatethenumericalsolutionusingtheoutputofODEsolvers

(用ODE输出对数值解进行赋值)

odextend

ExtendthesolutionofaninitialvalueproblemforanODE

对ODE初值问题的解进行延拓

SolverOptions(求解器选项)

AnoptionsstructurecontainsnamedpropertieswhosevaluesarepassedtoODEsolvers,andwhichaffectproblemsolution.Usethesefunctionstocreate,alter,oraccessanoptionsstructure.

选项结构包含署名属性,其值传递给ODE求解器以影响问题求解。

用这些函数可以创建,改变和接受选项结构。

Function(函数)

Description(描述)

odeset

CreateoralteroptionsstructureforinputtoODEsolver.(创建和改变选项)

odeget

Extractpropertiesfromoptionsstructurecreatedwithodeset.(提取属性选项)

OutputFunctions(输出函数)

Ifanoutputfunctionisspecified,thesolvercallsthespecifiedfunctionaftereverysuccessfulintegrationstep.YoucanuseodesettospecifyoneofthesesamplefunctionsastheOutputFcnproperty,oryoucanmodifythemtocreateyourownfunctions.

如果输出函数被指定,则求解器在每步积分后调用该函数进行输出。

你能够用odeset指定这些例子函数之一作为OutputFcn属性,或创建自己的函数对其进行修改。

odeplot

Time-seriesplot(时间序列图形)

odephas2

Two-dimensionalphaseplaneplot(2-维相平面图形)

odephas3

Three-dimensionalphaseplaneplot(3-维相平面图形)

odeprint

Printtocommandwindow(打印到命令窗)

FirstOrderODEs(一阶ODEs)

Anordinarydifferentialequation(ODE)containsoneormorederivatives

ofadependentvariableywithrespecttoasingleindependentvariablet,

usuallyreferredtoastime.Thederivativeofywithrespecttotisdenoted

asy′,thesecondderivativeasy′′,andsoon.Ofteny(t)isavector,having

elementsy1,y2,...,yn.

MATLABsolvershandlethefollowingtypesoffirst-orderODEs:

•ExplicitODEsoftheformy′=f(t,y)

形如y′=f(t,y)的显式ODEs

•LinearlyimplicitODEsoftheformM(t,y)y′=f(t,y),whereM(t,y)is

amatrix

形如M(t,y)y′=f(t,y)的线性隐式ODEs

•FullyimplicitODEsoftheformf(t,y,y′)=0(ode15ionly):

形如f(t,y,y′)=0的全隐式ODEs

HigherOrderODEs(高阶ODEs)

MATLABODEsolversacceptonlyfirst-orderdifferentialequations.Touse

thesolverswithhigher-orderODEs,youmustrewriteeachequationasan

equivalentsystemoffirst-orderdifferentialequationsoftheform

y′=f(t,y)

Youcanwriteanyordinarydifferentialequation

y(n)=f(t,y,y′,...,y(n−1))

asasystemoffirst-orderequationsbymakingthesubstitutions

y1=y,y2=y′,...,yn=y(n−1)

y1=y,y2=y’,...,yn=y(n−1)

Theresultisanequivalentsystemofnfirst-orderODEs.

Rewritethesecond-ordervanderPolequation

asasystemoffirst-orderODEs.

InitialValues(初值问题)

Generallytherearemanyfunctionsy(t)thatsatisfyagivenODE,and

additionalinformationisnecessarytospecifythesolutionofinterest.In

aninitialvalueproblem,thesolutionofinterestsatisfiesaspecificinitial

condition,thatis,yisequaltoy0atagiveninitialtimet0.Aninitialvalue

problemforanODEisthen

Ifthefunctionf(t,y)issufficientlysmooth,thisproblemhasoneandonlyone

solution.Generallythereisnoanalyticexpressionforthesolution,soitis

necessarytoapproximatey(t)bynumericalmeans.

NonstiffProblems(刚性问题)

Therearethreesolversdesignedfornonstiffproblems:

对于非刚性问题求解有3个求解器。

ode45BasedonanexplicitRunge-Kutta(4,5)formula,theDormand-Princepair.Itisaone-stepsolver–incomputingy(tn),itneedsonlythesolutionattheimmediatelyprecedingtimepoint,y(tn–1).Ingeneral,ode45isthebestfunctiontoapplyasa“firsttry”formostproblems.

ode45基于显式Runge--Kutta(4,5)公式,Dormand-Prince对,它是计算y(tn)的单步求解器,只需前一步的解y(tn-1).一般说来,ode45是对大多数问题的“第一试”的最好的函数。

ode23BasedonanexplicitRunge-Kutta(2,3)pairofBogackiandShampine.Itmaybemoreefficientthanode45atcrudetolerancesandinthepresenceofmildstiffness.Likeode45,ode23isaone-stepsolver.

ode113VariableorderAdams-Bashforth-MoultonPECEsolver.Itmaybemoreefficientthanode45atstringenttolerancesandwhentheODEfunctionisparticularlyexpensivetoevaluate.ode113isamultistepsolver—itnormallyneedsthesolutionsatseveralprecedingtimepointstocomputethecurrentsolution.

StiffProblems(刚性问题)

Notalldifficultproblemsarestiff,butallstiffproblemsaredifficultfor

solversnotspecificallydesignedforthem.Solversforstiffproblemscanbe

usedexactlyliketheothersolvers.However,youcanoftensignificantly

improvetheefficiencyofthesesolversbyprovidingthemwithadditional

informationabouttheproblem.(See“IntegratorOptions”onpage10-9.)

Therearefoursolversdesignedforstiffproblems:

并不是所有困难的问题都是刚性的,但是所有的刚性问题对于非专门为此设计的求解器来说都是困难的。

SolverSyntax(求解语法)

AlloftheODEsolverfunctions,exceptforode15i,shareasyntaxthatmakes

iteasytotryanyofthedifferentnumericalmethods,ifitisnotapparent

whichisthemostappropriate.Toapplyadifferentmethodtothesame

problem,simplychangetheODEsolverfunctionname.Thesimplestsyntax,

commontoallthesolverfunctions,is

求解函数调用

[t,y]=solver(odefun,tspan,y0,options)

wheresolverisoneoftheODEsolverfunctionslistedpreviously.

其中,solver是如前列举的ODE求解函数

Thebasicinputargumentsare

举例:

vanderPolEquation(Nonstiff)

ThisexampleillustratesthestepsforsolvinganinitialvalueODEproblem:

该例说明了求解ODE初值问题的步骤:

1Rewritetheproblemasasystemoffirst-orderODEs.Rewritethe

vanderPolequation(second-order)

1.把高阶方程表示为一阶方程组的等价形式。

vanderPol方程(二阶)

whereμ>

0isascalarparameter,bymakingthesubstitutiony’1=y2.The

resultingsystemoffirst-orderODEsis

为标量常数。

做代换

,得到对应的一阶方程组

2Codethesystemoffirst-orderODEs.Onceyourepresenttheequation

asasystemoffirst-orderODEs,youcancodeitasafunctionthatanODE

solvercanuse.Thefunctionmustbeoftheform

2.对一阶ODE方程组编写ODEfun函数,其形式为

dydt=odefun(t,y)

odefun函数程序

functiondydt=vdp1(t,y)

dydt=[y

(2);

(1-y

(1)^2)*y

(2)-y

(1)];

3.Applyasolvertotheproblem.(调用求解函数求解)

Decidewhichsolveryouwanttousetosolvetheproblem.Thencallthe

solverandpassitthefunctionyoucreatedtodescribethefirst-ordersystem

ofODEs,thetimeintervalonwhichyouwanttosolvetheproblem,and

aninitialconditionvector.

决定用哪个求解函数求解问题,然后调用求解器,把创建的描述方程组的函数,求解区间,和初始条件传递给求解函数。

ForthevanderPolsystem,youcanuseode45ontimeinterval[020]with

initialvaluesy

(1)=2andy

(2)=0.

对于VanderPol系统,你可以用ode45在时间区间[0,20]进行积分,初值条件为y

(1)=2和y

(2)=0,其调用求解函数的方法为

[t,y]=ode45(@vdp1,[020],[2;

0]);

4Viewthesolveroutput.Youcansimplyusetheplotcommandtoview

thesolveroutput.

4.视图求解输出。

你能够用plot命令视图解输出。

plot(t,y(:

1),'

-'

t,y(:

2),'

--'

title('

SolutionofvanderPolEquation,\mu=1'

);

xlabel('

timet'

ylabel('

solutiony'

legend('

y_1'

y_2'

Asanalternative,youcanuseasolveroutputfunctiontoprocesstheoutput.

ThesolvercallsthefunctionspecifiedintheintegrationpropertyOutputFcn

aftereachsuccessfultimestep.UseodesettosetOutputFcntothedesired

function.SeeSolverOutputProperties,inthereferencepageforodeset,for

moreinformationaboutOutputFcn.

作为选择,你能够用求解器输出处理输出。

vanderPolEquation(Stiff)(刚性vanderPol方程)

Thisexamplepresentsastiffproblem.Forastiffproblem,solutionscan

changeonatimescalethatisveryshortcomparedtotheintervalof

integration,butthesolutionofinterestchangesonamuchlongertimescale.

Methodsnotdesignedforstiffproblemsareineffectiveonintervalswherethe

solutionchangesslowlybecausetheyusetimestepssmallenoughtoresolve

thefastestpossiblechange.

该例表示的是一个刚性问题。

对于刚性问题,解在相对积分区间非常小的时间尺度上变化,感兴趣的解在更大的时间尺度上变化。

不是专为刚性问题设计的方法在解变换缓慢的区间上是无效的,因为它用的时间步长非常小以适应分辨快速变化。

Whenμisincreasedto1000,thesolutiontothevanderPolequation

changesdramaticallyandexhibitsoscillationonamuchlongertimescale.

Approximatingthesolutionoftheinitialvalueproblembecomesamore

difficulttask.Becausethisparticularproblemisstiff,asolverintendedfor

nonstiffproblems,suchasode45,istooinefficienttobepractical.Asolver

suchasode15sisintendedforsuchstiffproblems.

当增加到1000,vdp方程的解急剧变化,在更大时时间尺度上展示振荡。

近似初值问题的解是一个困难的问题。

因为这个特别的问题是刚性的,对于如ode45这样的非刚性求解器实际上是效率非常低的。

象ode15s是适用于刚性问题的。

Thevdp1000functionevaluatesthevanderPolsystemfromtheprevious

example,butwithμ=1000.

vdp1000函数对

的vdp方程组进行赋值。

functiondydt=vdp1000(t,y)

1000*(1-y

(1)^2)*y

(2)-y

(1)];

Nowusetheode15sfunctiontosolvetheproblemwiththeinitialcondition

vectorof[2;

0],butatimeintervalof[03000].Forscalingreasons,plot

justthefirstcomponentofy(t).

现在用ods15s求解具有初值向量[2;

0]和积分区间[0,3000]上的初值问题。

为尺度原因,仅画出

的第一分量。

[t,y]=ode15s(@vdp1000,[03000],[2;

SolutionofvanderPolEquation

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

当前位置:首页 > 医药卫生 > 基础医学

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

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