MATLAB Examples on the use of ode23 and ode45- MATLAB 使用 ode23 和 ode45 的示例.pdf

MATLAB Examples on the use of ode23 and ode45- MATLAB 使用 ode23 和 ode45 的示例.pdf

MATLABExamplesontheuseofode23andode45:

Example1:Useode23andode45tosolvetheinitialvalueproblemforafirstorder

differentialequation:

−ty

y=,(y0)=1,[0t,∈5]

2−y2

FirstcreateaMatLabfunctionandnameitfun1.m.

functionf=fun1(t,y)

f=-t*y/sqrt(2-y^2);

NowuseMatLabfunctionsode23andode45tosolvetheinitialvalueproblem

numericallyandthenplotthenumericalsolutionsy,respectively.IntheMatLabwindow,

typeinthefollowingcommandslinebyline.

文档评论(0)

1亿VIP精品文档

相关文档