丁丽娟《数值计算方法》五章课后实验题答案(源程序很详细,且运行无误).docx
《丁丽娟《数值计算方法》五章课后实验题答案(源程序很详细,且运行无误).docx》由会员分享,可在线阅读,更多相关《丁丽娟《数值计算方法》五章课后实验题答案(源程序很详细,且运行无误).docx(42页珍藏版)》请在课桌文档上搜索。
1、丁丽娟数值计算方法五章课后实验题答案(源程序都是自己写的,很详细,且保证运行无误)我做的五章数值实验作业题目如下:第二章:1、2、3、4题第三章:1、2题第四章:1、2题第六章:2、3题第八章:1、2题第二章(D对A进行列主元素三角分解:function1u=myfun(八)n=size(八);fork=l:nfori=k:nsum=0;m=k;forj=k(k-l)sum=sum+A(i,j)*A(j,k);ends(i)=A(i,k)-sum;ifabs(s(m)A=11111;12345;1361015;14102035;15153570;L,U=myfun(八)结果:L=1.00000
2、0001.00001.00000001.00000.50001.0000001.00000.75000.75001.000001.00000.25000.7500-1.00001.0000O4.000014.000034.000069.000000-2.0000-8.0000-20.5000000-0.5000-2.37500000-0.2500(2)求矩阵的逆矩阵A1:inv(八)结果为:ans=5-1010-51-1030-3519-410-3546-276-519-2717-41-46-41(3)检验结果:E=diag(lIlll)AEans=5-1010-51-519-2717-41-
3、46-41程序:functiond=myfun(a,b,c,d,n)fori=2:nl(i)=a(i)b(i-l);a(i)=l(i);u(i)=b(i)-c(i-l)*a(i);b(i)=u(i);y(i)=d(i)-a(i)*d(i-l);d(i)=y(i);endx(n)=d(n)b(n);d(n)=x(n);fori=(n-l):-l:lx(i)=(d(i)-c(i)*d(i+l)b(i);d(i)=x(i);end求各段电流量程序:a(i)=-2;endb=25555555;c=-2-2-2-2-2-2-2;V=220;R=27;d=VROOOOOOO;n=8;I=myfun(a,b
4、,c,d,n)运行程序得:I=8.14784.07372.03651.01750.50730.25060.11940.0477(1)求矩阵A和向量b的matlab程序:functionAb=myfun(n)fori=l:nX(i)=l0.1*i;endfori=l:nforj=l:nendendfori=l:nb(i)=sum(A(i,:);end求n=5时Al,bl及Al的2.条件数程序运行结果如下:n=5;Al,bl=myfun(n)Al=1.00001.10001.21001.33101.46411.00001.20001.44001.72802.07361.00001.30001.69
5、002.19702.85611.00001.40001.96002.74403.84161.00001.50002.25003.37505.0625bl=6.10517.44169.043110.945613.1875cond2=cond(A1,2)求n=10时A2,b2及A2的2.条件数程序运行结果如下:n=10;A2,b2=myfun(n)A2=1.0000.ooo1.21001.33IO1.46411.61051.77161.94872.14362.35791.00001.2(XX)1.44(X)1.72802.07362.4B832.98603.58324.29985.15981.00
6、001.30001.69002.19702.85613.71294.82686.27498.157310.60451.00001.40001.96002.74403.84165.37827.529510.541414.757920.66101.00001.50002.25003.37505.06257.593811.390617.085925.628938.44341.00001.60002.56004.09606.553610.485816.777226.843542.949768.71951.00001.70002.894.91308.352114.198624.137641.033969
7、.7576118.58791.00001.80003.24005.832010.497618.895734.012261.2220110.1996198.35931.00001.90003.61006.859013.032124.761047.045989.3872169.8356322.68771.00002.00004.00008.0000I6.OO32.000064.00I28.OO256.00512.0000b2=1.0e+003*0.01590.02600.04260.06980.11330.18160.28660.44510.68011.0230cond2=cond(A2,2)co
8、nd2=8.6823e+011求n=20时A3,b3及A3的2-条件数程序运行结果如下:n=20;A3,b3=myfun(n)A3=0.00000.00000.00000.00000.000.0000O.(XX)O0.00000.000.000.000.00000.000.00000.00000.00000.000.00000.00000.000.00000.000.000.00000.000.000.00000.00000.00000.00000.00000.000.00000.00000.000.00000.00000.000.00000.00000.000.00000.000.00000
9、.00000.00000.000.00000.00000.00000.0000O.(XX)O0.00000.0000O.O(XX)0.00O.(XX)O0.00000.00000.000.00000.000.000.00000.000.000.00000.00000.00000.00000.00000.000.00000.00000.000.00000.00000.000.00000.00000.00000.00000.00000.00000.000.0000O.O(XX)O.(XX)O0.00000.00000.000.00000.000.00000.00000.00000.000.0000
10、0.00000.000.00000.000.000.00000.000.00000.000.00000.00000.000.00000.000.00000.00000.000.00000.00000.000.00000.00000.00000.00000.00000.00000.000.0000O.O(XX)O.(XX)O0.00000.00000.00000.000.00000.00000.0000O.(XXX)0.0000O.(XX)O0.00O.O(XX)0.00000.000.000.00000.000.000.00000.00000.00000.00000.000.00000.000
11、.00000.00000.00000.000.00000.00000.00000.00000.00000.00000.00000.000.0000O.O(XX)O.(XX)O0.00000.00000.0000O.(XX)O0.00000.00000.00O.(XXX)0.0000O.(XX)O0.000.00000.00000.000.000.00O.O(XX)0.000.000.000.00000.000.000.00000.000.000.00000.00000.000.00000.00000.0000Columns11through200.00000.00000.000.000.000
12、.00000.00000.00000.000.00000.0000O.(XX)O0.00000.00000.00O.(XXX)0.00000.00000.000.00000.00000.000.000.00000.000.000.00000.00000.00000.00000.000.00000.000.00000.000.0000O.O(XX)0.00000.00000.00000.00000.00000.000.00000.000.000.000.00000.000.00000.000.0000O.(XX)O0.00000.00000.000.000.000.00000.00000.000
13、00.00000.000.000.000.00000.000.00000.00000.00000.000.00000.000.00000.000.0000O.O(XX)0.00000.00000.00010.00000.00000.000.00000.000.000.000.0l0.0l0.00020.000.0000O.(XX)O0.00000.000.000.00010.00010.00030.050.00000.00000.000.000.000.0l0.00010.00030.00060.130.000.00000.000.00000.0l0.0l0.00030.00070.150.3
14、20.000.00000.000.00010.0l0.030.0006O.I40.00320.750.000.00O.(XX)O0.00010.020.050.00120.00290.700.01670.00000.00000.0l0.0l0.040.090.00230.00580.01460.03640.000.00000.0l0.00020.00060.00170.440.01130.02950.07660.0000O.(XX)I0.020.00040.00110.00300.00800.02150.05810.15700.0000().(XX)10.00()20.0007().(X)18
15、0.(X)5I0.0143().(X)0.1119().3133O.O(XX)O.(X)O10.00040.00100.00300.860.02500.07260.21050.61030.0l0.00020.(XX)50.00160.00480.01430.04300.12910.38741.1623b3=1.0e+009*Columns1through100.00000.00000.00000.00000.00000.00000.00010.00020.00040.0010Columns11through200.00250.00590.01320.02870.06060.12460.2494
16、0.48740.93161.7434cond2=cond(A3,2)cond2=3.2395e+022由上述运行结果可知:它们是病态的,而且随着n的增大,矩阵的病态变得严重。(2)当n=5时:xl=Albxl=1.00001.00001.0000x2=A2b2,x2=1.00001.00001.00001.00010.99991.00001.00001.00001.00001.0000当n=20时:x3=A3b3,x3=1.0e+005*0.0203-0.17560.7034-3.43422.9927-1.87650.7820-0.1396-0.07200.0745-0.03500.0108-
17、0.00230.0003-0.00000.00000.00000.0000由运行结果可见:Xl与精确解吻合,X2与精确解稍有差异,X3与精确解差别很大。可见随着n的增大,矩阵病态越来越严重。(3)当n=10时:A2(2,2)=A(2,2)+le-8;A2(10,10)=A(10,10)le-8;1.01370.91971.20890.68441.30530.80391.08370.97711.00360.9997比较可见,系数矩阵出现微小变动,导致解出现较大变化。说明n=10时,系数矩阵是病态的。(1)A=10787;7565;86109;75910;b=32233331;det(八)ans=
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数值计算方法 丁丽娟 数值 计算方法 课后 实验 答案 源程序 详细 运行 无误
链接地址:https://www.desk33.com/p-781140.html