作业帮 > 综合 > 作业

用matlab求解常微分这个程序怎么编的啊?

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/18 01:36:15
用matlab求解常微分这个程序怎么编的啊?
我想编一个matlab程序,使用ode45求解:dy/dx=(y^2+5)*(x+6).
x范围是0到5,y0=0.5
奇怪的很,解出来的结果很特别.
function hh
%options=odeset()
[t,y]=ode23t(@fun,0:0.01:5,0.5)
plot(t,y)
function dy=fun(t,y)
dy=(y^2+5)*(t+6);
结果:
Warning:Failure at t=9.940611e-002.Unable to meet integration tolerances without reducing the step size below the smallest value allowed (3.531614e-016) at time t.
> In ode23t at 726
In try28 at 3
t =
0
0.0100
0.0200
0.0300
0.0400
0.0500
0.0600
0.0700
0.0800
0.0900
y =
0.5000
0.8275
1.1902
1.6108
2.1237
2.7926
3.7382
5.2505
8.2098
17.2406
>> y=dsolve('Dy=(y^2+5)*(t+6)','y(0)=0.5')
y =
5^(1/2)*tan(1/2*5^(1/2)*t^2+6*5^(1/2)*t+atan(1/10*5^(1/2)))
>> ezplot(y,[0 5])