求matlab 的code数学高手帮帮忙啊~ 不过是英文版的
来源:百度知道 编辑:UC知道 时间:2024/05/16 00:37:35
Consider the following initial-value problem:
8<
:
x0 = t2(tx x2)
x(1) = 2
(1)
The solution of (1) is given by
x(t) = (
1
2
+ ln t)1t:
Using Runge-Kutta method of order 4, Adams-Bashforth three-step method of order
3 and Adams-Moulton method of order 3 to solve (1) on the interval [0; 3] on the
interval [1; 3] using step of h = 1
128 . Compare their errors to true solution and CPU
time.
我是copy paste的,乱了(1)方程组是x'=t^(-2)*(t*x-x^2)和x(1)=2
the solution 是x(t)=(1/2+lnt)^(-1)*t
8<
:
x0 = t2(tx x2)
x(1) = 2
(1)
The solution of (1) is given by
x(t) = (
1
2
+ ln t)1t:
Using Runge-Kutta method of order 4, Adams-Bashforth three-step method of order
3 and Adams-Moulton method of order 3 to solve (1) on the interval [0; 3] on the
interval [1; 3] using step of h = 1
128 . Compare their errors to true solution and CPU
time.
我是copy paste的,乱了(1)方程组是x'=t^(-2)*(t*x-x^2)和x(1)=2
the solution 是x(t)=(1/2+lnt)^(-1)*t
function ode4
clear;clc
[t,x]=ode45(@fun,1:3,2)
[t1,x1]=ode23t(@fun,1:3,2)
x=dsolve('Dx=t^(-2)*(t*x-x^2)','x(1)=2')
x2=subs(x)
function dx=fun(t,x)
dx=t^(-2)*(t*x-x^2);
结果:
t =
1
2
3
x =
2.0000
1.6763
1.8767
t1 =
1
2
3
x1 =
2.0000
1.6752
1.8760
x =
t/(log(t)+1/2)
x2 =
2.0000
1.6762
1.8766