用matlab 解方程 y’ = −20y, y(0) = 1 for 0 ≤ t ≤ 1.
UseRunge-Kuttaorder4andthetrapezoidalmethod.Tryfirstthestepsizeh=0.05,andgraphtheexac...
UseRunge-Kutta order 4 and the trapezoidal method. Try first the step size h= 0.05,and graph the exact solution and the two numerical solutions. You should seethat Runge-Kutta provides a better approximation than the trapezoidal method.This is to be expected, since Runge-Kutta is a higher-order method.
Now,increase the step size to h= 0.15.You should see that the approximation obtained by the trapezoidal method isso-so. However, Runge-Kutta behaves really badly! Instead of decreasing tozero, the solution increases! Experiment with other values of halso.
Runge-Kuttaworks much better than other methods when the step size hissmall. If the step size is not small, Runge-Kutta (and the other explicitmethods, like Euler, etc.) can fail to even predict the correct trend, whilethe trapezoidal method still provides a reasonable approximation.
Notethat since the trapezoidal method is implicit, it will in general be hard tosolve for wi+1. It is quite easyin this case though.
求大神 解答 展开
Now,increase the step size to h= 0.15.You should see that the approximation obtained by the trapezoidal method isso-so. However, Runge-Kutta behaves really badly! Instead of decreasing tozero, the solution increases! Experiment with other values of halso.
Runge-Kuttaworks much better than other methods when the step size hissmall. If the step size is not small, Runge-Kutta (and the other explicitmethods, like Euler, etc.) can fail to even predict the correct trend, whilethe trapezoidal method still provides a reasonable approximation.
Notethat since the trapezoidal method is implicit, it will in general be hard tosolve for wi+1. It is quite easyin this case though.
求大神 解答 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询