- 1、本文档共46页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
[医药卫生]药物计算分析导论-第二部分-11-12章Matlab
This Lecture More accurate schemes More complicated ODEs Variable time step and embedded methods used to make sure errors are within a tolerance. Adams-Bashforth Schemes In the forward Euler scheme we only used the value of the right hand side at the previous time step. i.e. we only used a linear approximation to the time derivative AB Schemes Idea: we set where If interpolates fn,fn-1,fn-2,..,fn+1-Nstages i.e.: AB Schemes Essentially we use interpolation and a Newton-Cotes quadrature formula to formulate: Runge-Kutta Schemes See van Loan for derivation of Runge-Kutta2 and Runge-Kutta4. The following (simple) scheme due to Jameson, Schmidt and Turkel (1981): Runge-Kutta Schemes Beware, it only works when f is a function of y and not t here s is the order of the scheme. Error Estimate Matlab has a number of time integrators built in. ode23 ode45 and others.. ode23 For n=1:#timesteps ode23 uses two estimates for yn+1 . A 2nd order RK scheme and a 3rd order RK scheme are used to build two guesses for yn+1. If the difference between these two estimates are within a tolerance ode23 progresses on to calculating yn+2 If the difference is greater than the specified tolerance, ode23 reduces the dt and tries again. It repeats until the difference is lower than the tolerance. End Planets Example Using ode23 Idea: replace our home grown Euler Forward scheme with Matlab’s ode23 scheme in the planets1.m script. Team Exercise Grab planets2.m and forcing.m Run the script Use the Tsteps vector to find out the time step for each integration stage. Plot a graph showing the time step (dt) at each time step. Use help to find out how to change the tolerance used by ode23 (hint you will need to use odeset) Rerun the simulation with a tolerance of 0.1 Application: One-Dimensional Electrostatic Motion Charge Repulsion Now we will consider the case of charged particles with the same sign charge Instead of attracting each other, the charges repel each other
文档评论(0)