Matlab实现——Adams-Bashforth-Method

ABM数值积分法解析
本文介绍了一种基于预测校正思想的数值积分方法——ABM算法,并通过具体实例展示了其在解决微分方程组问题上的应用过程。该方法适用于已知初始条件的情况,能够有效提高计算精度。

欢迎前往个人博客 驽马点滴 和视频空间 哔哩哔哩-《挨踢日志》

abm.m

 

function A = abm(f,T,Y)

%Input   - f is the function entered as a string 'f'

%        - T is the vector of abscissas

%        - Y is the vector of ordinates

%Remark.   The first four coordinates of T and Y must 

%          have starting values obtained with RK4

%Output  - A=[T?? Y??] where T is the vector of abscissas 

%          and Y is the vector of ordinates

n=length(T);

if n>=5

    F=zeros(1,4);

    F=feval(f, T(1:4), Y(1:4));

    h=T(2)-T(1);

    for k=4:n-1

         %Predictor

         p=Y(k)+(h/24)*(F*[-9  37  -59  55]');

         T(k+1)=T(1)+h*k;

         F=[F(2) F(3) F(4) feval(f, T(k+1), p)];

         %Corrector

         Y(k+1)=Y(k)+(h/24)*(F*[1  -5  19  9]');

         F(4)=feval(f, T(k+1), Y(k+1));

    end

    A=[T' Y'];

end
 
fun1.m
function f=fun1(t,y)

f=t.^2-y;
 
Untitlel.m
 
T=[0,0.05,0.10,0.15,0.20,0.25,0.03];
Y=[1,0.95127058,0.90516258,0.86179202,0,0,0];
f='fun1';
A=abm(f,T,Y)
欢迎前往个人博客  驽马点滴 和视频空间 哔哩哔哩-《挨踢日志》
 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值