自适应步长Runge-Kutta-Fehlberg method for solving ODE system的matlab实现
已有 6524 次阅读
2010-5-20 01:20
|个人分类:科研笔记|系统分类:科研笔记
用于解决ODE系统。
function [tt,xx,k]=rkf45 (ftys,a,Alpha,b,h,delta,M)
%---------------------------------------------------------------------------
%RKF45 % Runge-Kutta-Fehlberg solution for a system Y' = F(T,Y) with Y(a) = Y_a.
% Sample call
% [tt,xx,k] = rkf45('f',a,Alpha,b,h,delta,M)
% Inputs
% f name of the function
% a left endpoint of [a,b]
% Alpha initial value
% b right endpoint of [a,b]
% h initial step size
% delta threshhold for stepsize acceptance
% M maximum number of iterations allowed
% Outputs
% tt solution: array of points during the computation
% xx solution: array of corresponding approximations at the points.
% k n