数学实验作业题(1-6)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
第一次作业P78-79页1.解:
输入:x=-3:0.1:3;
y=-3:0.1:3;
[x,y]=meshgrid(x,y);
z=-cos(2*x).*sin(3*y);
surf(x,y,z)
输出:
2.解:
输入:x=-pi:0.1:pi;
y=-pi:0.1:pi;
[x,y]=meshgrid(x,y);
z=exp(-(x.^2+y.^2)/8).*(cos(x).^2+sin(y).^2) surf(x,y,z)
输出:
4.解:
输入:u=0:0.1:2*pi; v=0:0.1:2*pi;
[u,v]=meshgrid(u,v); x=(3+cos(u)).*cos(v); y=(3+cos(u)).*sin(v); z=sin(u);
mesh(x,y,z)
输出:
5.解:
输入:u=-1:0.1:1; v=0:0.1:8;
[u,v]=meshgrid(u,v); x=u.*cos(v);
y=u.*sin(v);
z=v/3;
mesh(x,y,z)
输出:
第二次作业P126页
1.(1)解:
>> y=dsolve('D2y+6*Dy+13*y=0','x')
y =C1*exp(-3*x)*sin(2*x)+C2*exp(-3*x)*cos(2*x)
(2) 解:
>> y=dsolve('D4y+2*D2y+y=0','x')
y =C1*sin(x)+C2*cos(x)+C3*sin(x)*x+C4*cos(x)*x
(3) 解:
>> y=dsolve('D4y-2*D3y+D2y=0','x')
y =C1*exp(x)+C2*exp(x)*x+C3+C4*x
(4)解:
>> y=dsolve('D2y-2*Dy+5*y=exp(x)*sin(2*x)','x')
y =exp(x)*sin(2*x)*C2+exp(x)*cos(2*x)*C1-1/4*exp(x)*cos(2*x)*x (5)解:
>> y=dsolve('D2y-6*Dy+9*y=(x+1)*exp(3*x)','x')
y =exp(3*x)*C2+exp(3*x)*x*C1+1/6*(x^3+3*x^2+2*x)*exp(3*x) 2.(1)解:
>> dsolve('D2y+4*Dy+29*y=0','y(0)=0,Dy(0)=15','x')
ans =3*exp(-2*x)*sin(5*x)
(3) 解:
>> dsolve('D2y+y+sin(2*x)=0','y(pi)=1,Dy(pi)=1','x')
ans =-1/3*sin(x)-cos(x)+1/3*sin(2*x)
3. 解:
>> dsolve('(x^2-1)*Dy+2*x*y-cos(x)=0','y(0)=1','x')
ans =(sin(x)-1)/(x^2-1)
f=inline('(cos(x)-2*x*y)/(x^2-1)','x','y');
[x,y]=ode45(f,[0,1],1)
x =
0.0250
0.0500
0.0750
0.1000
0.1250
0.1500
0.1750
0.2000
0.2250
0.2500
0.2750
0.3000
0.3250
0.3500
0.3750
0.4000
0.4250
0.4500
0.4750
0.5000
0.5250
0.5500
0.5750
0.6250
0.6500
0.6750
0.7000
0.7250
0.7500
0.7750
0.8000
0.8250
0.8500
0.8750
0.9000
0.9250
0.9500
0.9750
1.0000 y =
1.0000
0.9756
0.9524
0.9303
0.9093
0.8892
0.8701
0.8520
0.8347
0.8183
0.8028
0.7880
0.7742
0.7611
0.7488
0.7374
0.7269
0.7172
0.7085
0.7008
0.6941
0.6886
0.6843
0.6802
0.6809
0.6837
0.6890
0.6976
0.7102
0.7277
0.7519
0.7851
0.8319
0.8964
0.9910
1.1404
NaN
NaN
NaN
-Inf
>> ode45(f,[0,1],1);
00.10.20.30.40.50.60.70.80.91 5. 解:
>> [x,y]=dsolve('Dx=y-3*x,Dy=8*x-y','x(0)=1,y(0)=4')
x =exp(t)