Matlab 已知y''-3y'+2y=0 y(0)=1 y'(0)=0 ,求y(0.5) 会的帮忙写下程序 用ode4
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/10 12:48:32
Matlab 已知y''-3y'+2y=0 y(0)=1 y'(0)=0 ,求y(0.5) 会的帮忙写下程序 用ode45实现最好
function hh
[t,y] = ODE45(@myfun,0:0.1:2,[1 0]);
[t,y]
y05=y(find(t==0.5))
plot(t,y(:,1))
%解析法验证
y2=dsolve('D2y-3*Dy+2*y=0','y(0)=1,Dy(0)=0')
t2=0:0.1:2;
y2=subs(y2,'t',t2)
hold on
plot(t2,y2,'or')
function dy=myfun(t,Y)
y=Y(1);y1=Y(2);
dydt=y1;
dy1dt=3*y1-2*y;
dy=[dydt;dy1dt];
结果:
ans =
0 1.0000 0
0.1000 0.9889 -0.2325
0.2000 0.9510 -0.5408
0.3000 0.8776 -0.9445
0.4000 0.7581 -1.4674
0.5000 0.5792 -2.1391
0.6000 0.3241 -2.9960
0.7000 -0.0277 -4.0829
0.8000 -0.5020 -5.4550
0.9000 -1.1305 -7.1801
1.0000 -1.9525 -9.3416
1.1000 -3.0167 -12.0418
1.2000 -4.3830 -15.4062
1.3000 -6.1252 -19.5890
1.4000 -8.3343 -24.7791
1.5000 -11.1222 -31.2079
1.6000 -14.6266 -39.1593
1.7000 -19.0164 -48.9806
1.8000 -24.4992 -61.0976
1.9000 -31.3296 -76.0310
2.0000 -39.8203 -94.4187
y05 =
0.5792
y2 =
-exp(2*t)+2*exp(t)
y2 =
Columns 1 through 13
1.0000 0.9889 0.9510 0.8776 0.7581 0.5792 0.3241 -0.0277 -0.5020 -1.1304 -1.9525 -3.0167 -4.3829
Columns 14 through 21
-6.1251 -8.3342 -11.1222 -14.6265 -19.0162 -24.4989 -31.3294 -39.8200
[t,y] = ODE45(@myfun,0:0.1:2,[1 0]);
[t,y]
y05=y(find(t==0.5))
plot(t,y(:,1))
%解析法验证
y2=dsolve('D2y-3*Dy+2*y=0','y(0)=1,Dy(0)=0')
t2=0:0.1:2;
y2=subs(y2,'t',t2)
hold on
plot(t2,y2,'or')
function dy=myfun(t,Y)
y=Y(1);y1=Y(2);
dydt=y1;
dy1dt=3*y1-2*y;
dy=[dydt;dy1dt];
结果:
ans =
0 1.0000 0
0.1000 0.9889 -0.2325
0.2000 0.9510 -0.5408
0.3000 0.8776 -0.9445
0.4000 0.7581 -1.4674
0.5000 0.5792 -2.1391
0.6000 0.3241 -2.9960
0.7000 -0.0277 -4.0829
0.8000 -0.5020 -5.4550
0.9000 -1.1305 -7.1801
1.0000 -1.9525 -9.3416
1.1000 -3.0167 -12.0418
1.2000 -4.3830 -15.4062
1.3000 -6.1252 -19.5890
1.4000 -8.3343 -24.7791
1.5000 -11.1222 -31.2079
1.6000 -14.6266 -39.1593
1.7000 -19.0164 -48.9806
1.8000 -24.4992 -61.0976
1.9000 -31.3296 -76.0310
2.0000 -39.8203 -94.4187
y05 =
0.5792
y2 =
-exp(2*t)+2*exp(t)
y2 =
Columns 1 through 13
1.0000 0.9889 0.9510 0.8776 0.7581 0.5792 0.3241 -0.0277 -0.5020 -1.1304 -1.9525 -3.0167 -4.3829
Columns 14 through 21
-6.1251 -8.3342 -11.1222 -14.6265 -19.0162 -24.4989 -31.3294 -39.8200
Matlab 已知y''-3y'+2y=0 y(0)=1 y'(0)=0 ,求y(0.5) 会的帮忙写下程序 用ode4
已知y^2+3y-1=0求y^4/y^8+3y^4+1的值
MATLAB求方程y’= y - 2x/y,y(0) = 1 (0≤x≤1,h = 0.1) 的数值解,要求编写程序
已知y²-3y+1=0,求下列分式的值 y²+(1/y²) y²/y的4次方+y
用matlab求最小值 (1)y=(x-3)^2-1 在区间(0,5)内求最小值; 求大神将程序写下,
已知|3x-y|+|x+y|=0,求x-y除以x*y的值.
y'+y-y^(2/3)=0; x=0:0.1:1 怎么用matlab求解?
已知|2x-3y|+|3x-y-1|=0,求x,y的值.
已知:x,y满足|2x-y|+|y-1/2|=0,求7x-3y的值.
若y平方-y-1=0,求代数式y的三次方-3y平方+y-2的值
求y的通解:(1) y''=1+(y')^2(2) y''(y^3)+1=0
已知:x+y=2,2y²-y-4=0,求y-x/y的值