《《数学实验》(公选课)试卷.doc》由会员分享,可在线阅读,更多相关《《数学实验》(公选课)试卷.doc(9页珍藏版)》请在三一办公上搜索。
1、徐州工程学院试卷 2011 2012 学年第 2 学期 课程名称 数学实验 校区:班级:姓名:学号:1. 求方程的所有根。程序:clcclear allp=5,0,-4,0,7,0;x=roots(p)结果:x =0 或 -0.8897 + 0.6258i或-0.8897 - 0.6258i或0.8897 + 0.6258i或0.8897 - 0.6258i2. 设,试在上求出该函数的零点以及极大、极小值。程序:(1):求零点clcclear allf=(x)exp(2*sin(x).*cos(x)-exp(2*cos(x).*sin(x);x=fzero(f,-5,5)结果:x=-4.925
2、0 3.9270(2)求极大值和极小值点syms xy=exp(2*sin(x)*cos(x)-exp(2*cos(x)*sin(x);dy=diff(y) %求一阶导数x1=double(solve(dy)结果x1 =2.1999(3)求极值clcclear allx=-5,2.1999,5; %求x=-5,2.1999,5时的各个函数值,最大的就是极大值,最小的就是极小值y=exp(2*sin(x).*cos(x)-exp(2*cos(x).*sin(x)结果:Y= 0.2396 -3.2140 1.7328所以极小值-3.2140,极大值1.7328。3. 求极限。程序:clcclear
3、 allsyms xf=(x-sin(x)/(x3);limit(f,x,0)结果:ans = 1/6所以极限为1/6。4. ,求。程序:clcclear allsyms xf=exp(x)*sin(x);diff(f,x,7)结果:ans =8*exp(x)*sin(x) - 8*exp(x)*cos(x)5. 将在处展开(最高幂次为7)。程序:clcclear allsyms xy=sqrt(1+x);taylor(y,x,8,0) %求泰勒展开结果:ans =(33*x7)/2048 - (21*x6)/1024 + (7*x5)/256 - (5*x4)/128 + x3/16 - x
4、2/8 + x/2 + 16. ,求。程序:clcclear allsyms xy=exp(sin(1/x);y3=diff(y,x,3);x=2;y=exp(sin(1/x)结果:y =1.61517. 某人进行射击试验,假定在300米外的命中率为0.03,现重复射击500次,问其至少命中5发的概率为多少?程序:clcclear alln=500;p=0.03;x=5;binocdf(x,n,p)结果:ans =0.00258. 已知服从参数为的正态分布,试用专用命令求。程序:clcclear allmu=1;sigma=7;p=normcdf(5,mu,sigma)-normcdf(1,m
5、u,sigma)结果:p =0.21619. 某车间用包装机包装白糖,额定标准为每袋重kg,据长期经验知,该包装机包装的糖重服从,现从该包装机包装的糖中随机抽取10袋,测的糖重如下:0.457 0.506 0.578 0.516 0.4830.512 0.515 0.510 0.488 0.497能否认为该包装机包装的糖重是正常的?程序:clcclear allX=0.457,0.506,0.578,0.516,0.483,0.512,0.515,0.510,0.488,0.497;h,sig,ci,zval=ztest(X,0.5,0.015,0.05,0)结果:h = 0sig = 0.1
6、912ci = 0.4969 0.5155zval =1.3071结果表明h =0,说明在水平a=0.05,可拒绝原假设,即认为包装机不正常。10. ,求,并求的特征值与特征向量。程序:clcclear allA=-2 1 1;0 2 0;-4 1 3;a=det(A) %求行列式的值b=inv(A) %求逆矩阵V,D=eig(A) %求特征值和特征向量结果:a = -4b = -1.5000 0.5000 0.5000 0 0.5000 0 -2.0000 0.5000 1.0000V = -0.7071 -0.2425 0.3015 0 0 0.9045 -0.7071 -0.9701 0
7、.3015D = -1 0 0 0 2 0 0 0 211.已知,分别在下列条件下画出的图形(1) 时,(利用窗口切割画在同一个图形中);(2) 时,(利用窗口切割画在同一个图形中);程序:clcclear allx=linspace(-5,5,1000);a=1;b=0;figure(1) %画时,时的图y=1/(sqrt(2*pi)*a)*exp(-(x-b).2/(2*a2);subplot(3,1,1);plot(x,y);a=1;b=-1;y=1/(sqrt(2*pi)*a)*exp(-(x-b).2/(2*a2);subplot(3,1,2);plot(x,y);y=1/(sqrt
8、(2*pi)*a)*exp(-(x-b).2/(2*a2);a=1;b=1;subplot(3,1,3);plot(x,y);figure(2) %画时,时的图b=0;a=1;y=1/(sqrt(2*pi)*a)*exp(-(x-b).2/(2*a2);subplot(3,1,1);plot(x,y);b=0;a=2;y=1/(sqrt(2*pi)*a)*exp(-(x-b).2/(2*a2);subplot(3,1,2);plot(x,y);b=0;a=4;y=1/(sqrt(2*pi)*a)*exp(-(x-b).2/(2*a2);subplot(3,1,3);plot(x,y);结果:f
9、igure(1)figure(2)12.三维绘图(3)程序:clcclear allclose allt=linspace(0,20,100);u=linspace(0,2,100);x=u.*sin(t);y=u.*cos(t);z=t/4;plot3(t,u,x,r) %红色的线-xhold onplot3(t,u,y,b) %蓝色的线-yhold onplot3(t,u,z,g) %绿色的线-zxlabel(t-axis),ylabel(u-axis),title(第一题)图像:(4)程序:clcclear allclose allx=linspace(0,3,1000);y=linsp
10、ace(0,3,1000);z=sin(x.*y);plot3(x,y,z);xlabel(x-axis),ylabel(y-axis),zlabel(z-axis);title(第二题)图像:13.下表给出了某地区家庭人均鸡肉年消费量Y与家庭月收入X,鸡肉价格(元/千克),猪肉价格(元/千克)与牛肉价格(元/千克)的相关数据。表1 某地区消费肉类情况表年份Y/元X/元P1P2P319802.783974.225.077.8319812.994133.815.27.9219822.984394.035.47.9219833.08459待添加的隐藏文字内容23.955.537.9219843.1
11、24923.735.477.7419853.335283.816.378.0219863.565603.936.988.0419873.646243.786.598.3919883.676663.846.458.5519893.847174.0179.3719904.047683.867.3210.6119914.038433.986.7810.4819924.189113.977.9111.419934.049315.219.5412.4119944.0710214.899.4212.7619954.0111655.8312.3514.2919964.2713495.7912.9914.36
12、19974.4114495.6711.7611.7619984.6715756.3713.0913.0919995.0617596.1612.9812.9820005.0119945.8912.812.820015.1722586.6414.114.120025.2924787.0416.8216.82(5) 求回归方程;解题思想:一元线性回归方程:求回归系数:的过程程序:clcclear allX=397,413,439,459,492,528,560,624,666,717,768,843,911,931,1021,1165,1349,1449,1575,1759,1994,2258,24
13、78;Y=2.78,2.99,2.98,3.08,3.12,3.33,3.56,3.64,3.67,3.84,4.04,4.03,4.18,4.04,4.07,4.01,4.27,4.41,4.67,5.06,5.01,5.17,5.29;x=mean(X); %求X列的平均值y=mean(Y); %求Y列的平均值X1=;X2=;for i=1:length(X) %求列各个值存入X1列中 X1(i)=(X(i)-x)*(Y(i)-y);endlxy=sum(X1) %求for i=1:length(X) %求列各个值存入X2列中 X2(i)=(X(i)-x)2;endlxx=sum(X2)
14、%求b=lxy/lxx %a=y-b*x %disp(回归方程是y=,num2str(a),+,num2str(b),x)结果:lxy = 9.4934e+003lxx = 8.3995e+006b = 0.0011a = 2.7976回归方程是y=2.7976+0.0011302x(6) 检验回归方程的显著性。解题思想:对于两组数据序列,根据求出两组数据的相关系数,越大(接近于1),X,Y相关性越大,即回归方程的显著性越高。程序:clcclear allX=397,413,439,459,492,528,560,624,666,717,768,843,911,931,1021,1165,13
15、49,1449,1575,1759,1994,2258,2478;Y=2.78,2.99,2.98,3.08,3.12,3.33,3.56,3.64,3.67,3.84,4.04,4.03,4.18,4.04,4.07,4.01,4.27,4.41,4.67,5.06,5.01,5.17,5.29;x=mean(X); %求X列的平均值y=mean(Y); %求Y列的平均值for i=1:length(X) %求列各个值存入X1列中 X1(i)=(X(i)-x)*(Y(i)-y);endr1=sum(X1); %求for i=1:length(X) %求列各个值存入X2列中 X2(i)=(X(
16、i)-x)2;endr2=sum(X2); %求for i=1:length(Y) %求列各个值存入Y1列中 Y1(i)=(Y(i)-y)2;endr3=sum(Y1); %求r=r1/(sqrt(r2*r3) %求相关系数r结果: r =0.9472结论:相关系数接近于1,回归方程的显著性很高。14.设,试判断数列是否收敛。解题思想:通过迭代98次看最后两个数是否几乎一样,如果几乎一样则收敛,否则不收敛程序:clcclear allx=;x(1)=3;x(2)=(x(1)+7/x(1)/2;n=1;for n=2:100 %迭代98次 x(n+1)=(x(n)+7/x(n)/2;enddis
17、p(迭代结果是:x(n):,num2str(x(n),x(n-1):,num2str(x(n-1)结果:迭代结果是:x(n):2.6458,x(n-1):2.6458结论:所以收敛。15.试编写m文件将用初等行变换一步步化为单位阵。解题思想:通过对矩阵做出等行列变换一步步化得程序:clcclear allA=-2 1 1;0 2 0;-4 1 3;A(1,:)=A(1,:)*(-2); %r1=r1*2A(3,:)=A(3,:)+A(1,:); %r3=r3+r1A(1,:)=A(1,:)+A(3,:)*2; %r1=r1+r3*2A(1,:)=A(1,:)/4; %r1=r1/4A(:,2)=A(:,2)+A(:,1); %c2=c2+c1A(:,2)=A(:,2)+A(:,3); %c2=c2+c3A(:,2)=A(:,2)/2 %c2=c2/2结果:A = 1 0 0 0 1 0 0 0 1