资源描述:
《MATLAB作业3参考答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、MATLAB作业三参考答案1、请将下面给出的矩阵A和B输入到MATLAB环境中,并将它们转换成符号矩阵。若某一矩阵为数值矩阵,另以矩阵为符号矩阵,两矩阵相乘是符号矩阵还是数值矩阵。【求解】矩阵的输入与转换是很直接的。>>A=[5,7,6,5,1,6,5;2,3,1,0,0,1,4;6,4,2,0,6,4,4;3,9,6,3,6,6,2;10,7,6,0,0,7,7;7,2,4,4,0,7,7;4,8,6,7,2,1,7];A=sym(A)A=[5,7,6,5,1,6,5][2,3,1,0,0,1,4][6,4,2,0,6,4,4
2、][3,9,6,3,6,6,2][10,7,6,0,0,7,7][7,2,4,4,0,7,7][4,8,6,7,2,1,7]>>B=[3,5,5,0,1,2,3;3,2,5,4,6,2,5;1,2,1,1,3,4,6;3,5,1,5,2,1,2;4,1,0,1,2,0,1;-3,-4,-7,3,7,8,12;1,-10,7,-6,8,1,5];B=sym(B)B=[3,5,5,0,1,2,3][3,2,5,4,6,2,5][1,2,1,1,3,4,6][3,5,1,5,2,1,2][4,1,0,1,2,0,1][-3,-4,-7
3、,3,7,8,12][1,-10,7,-6,8,1,5]2、利用MATLAB语言提供的现成函数对习题1中给出的两个矩阵进行分析,判定它们是否为奇异矩阵,得出矩阵的秩、行列式、迹和逆矩阵,检验得出的逆矩阵是否正确。【求解】以A矩阵为例,可以对其进行如下分析。>>A=[5,7,6,5,1,6,5;2,3,1,0,0,1,4;6,4,2,0,6,4,4;3,9,6,3,6,6,2;10,7,6,0,0,7,7;7,2,4,4,0,7,7;4,8,6,7,2,1,7];A=sym(A);rank(A)ans=7>>det(A)ans=-
4、35432>>trace(A)ans=27>>B=inv(A);>>A*Bans=[1,0,0,0,0,0,0][0,1,0,0,0,0,0][0,0,1,0,0,0,0][0,0,0,1,0,0,0][0,0,0,0,1,0,0][0,0,0,0,0,1,0][0,0,0,0,0,0,1]3、试求出习题1中给出的A和B矩阵的特征多项式、特征值与特征向量,并对它们进行LU分解。【求解】仍以A矩阵为例。>>A=[5,7,6,5,1,6,5;2,3,1,0,0,1,4;6,4,2,0,6,4,4;3,9,6,3,6,6,2;10,7
5、,6,0,0,7,7;7,2,4,4,0,7,7;4,8,6,7,2,1,7];A=sym(A);eig(A)ans=5.009396680079366526215873006955228.679593193974410579078264020229.27480714110743938760483528351799e-1+1.1755376247101009492093136044131*i-1.6336795424500642956747726147329+6.9740721596526560301948635104611*i
6、-3.4765922173751363914655588544224-1.6336795424500642956747726147329-6.9740721596526560301948635104611*i.27480714110743938760483528351799e-1-1.1755376247101009492093136044131*i>>p=poly(A)p=x^7-27*x^6-18*x^5-1000*x^4+3018*x^3+24129*x^2+2731*x+35432>>p=sym2poly(p)p=1-2
7、7-18-1000301824129273135432>>[LU]=lu(A)L=0.50000.50720.55560.10990.50000.53761.00000.20000.2319-0.75000.64290.57021.000000.6000-0.0290-0.94441.00000000.30001.0000000001.00000000000.7000-0.42031.000000000.40000.75360.27780.64841.000000U=10.00007.00006.0000007.00007.00
8、0006.90004.20003.00006.00003.9000-0.1000001.56525.26092.52173.73912.05800005.05568.55563.44441.74070000-8.7692-8.01102.5751000003.8