常微分方程数值解法,差分公式中,为什么显

2025-06-26 16:31:27
推荐回答(2个)
回答1:

odefun=@(t,x)[x(2);3*x(2)-2*x(1)+1];
[t,y]=ode45(odefun,[0:0.01:2],[1 0]);
plot(t,y)
[t y]
结果
y(0.5000)=0.7896
y= dsolve('D2y-3*Dy+2*y=1','Dy(0)=0','y(0)=1');
>> y
y =
exp(t) - exp(2*t)/2 + 1/2
>> feval(@(t)exp(t) - exp(2*t)/2 + 1/2,0.5)
ans =
0.7896

回答2:

显示公式计算时,积分步长有限制,当大于某个时间步长时,积分结果会发散,而隐式没有这个问题。