大连理工大学线性代数实验上机报告.docx
- 文档编号:10024765
- 上传时间:2023-02-08
- 格式:DOCX
- 页数:24
- 大小:30.42KB
大连理工大学线性代数实验上机报告.docx
《大连理工大学线性代数实验上机报告.docx》由会员分享,可在线阅读,更多相关《大连理工大学线性代数实验上机报告.docx(24页珍藏版)》请在冰豆网上搜索。
大连理工大学线性代数实验上机报告
大连理工大学线性代数实验上机报告
实验一
首先随机生成五阶方阵A
A=rand(5)
A=
0.81470.09750.15760.14190.6557
0.90580.27850.97060.42180.0357
0.12700.54690.95720.91570.8491
0.91340.95750.48540.79220.9340
0.63240.96490.80030.95950.6787
>>B=rand(5)
随机生成五阶方阵B
B=
0.75770.70600.82350.43870.4898
0.74310.03180.69480.38160.4456
0.39220.27690.31710.76550.6463
0.65550.04620.95020.79520.7094
0.17120.09710.03440.18690.7547
>>b=rand(1,5)'
随机生成列向量b
b=
0.2760
0.6797
0.6551
0.1626
0.1190
计算A+B
>>A+B
ans=
1.57250.80360.98110.58061.1455
1.64890.31031.66540.80330.4813
0.51920.82381.27431.68131.4954
1.56891.00371.43561.58741.6434
0.80351.06200.83471.14641.4334
计算A-B
>>A-B
ans=
0.0570-0.6085-0.6658-0.29690.1660
0.16270.24670.27580.0402-0.4099
-0.26520.27000.64010.15020.2028
0.25790.9113-0.4648-0.00300.2246
0.46120.86780.76580.7726-0.0760
计算A*B+B*A
>>A*B+B*A
ans=
3.02882.30583.14392.72763.1034
2.90942.19673.00403.07373.2584
3.34222.14233.21043.57343.9049
4.14462.97944.36764.23544.9170
3.13501.77873.22893.11703.2815
求Ax=b的解
>>x=A\b
x=
-0.9850
2.4396
3.3124
-5.6515
1.7085
验证克莱姆法则
>>c=A(:
1)
c=
0.8147
0.9058
0.1270
0.9134
0.6324
>>d=A(:
2)
d=
0.0975
0.2785
0.5469
0.9575
0.9649
>>e=A(:
3)
e=
0.1576
0.9706
0.9572
0.4854
0.8003
>>f=A(:
4)
f=
0.1419
0.4218
0.9157
0.7922
0.9595
>>g=A(:
5)
g=
0.6557
0.0357
0.8491
0.9340
0.6787
>>B1=[b';d';e';f';g']'
B1=
0.27600.09750.15760.14190.6557
0.67970.27850.97060.42180.0357
0.65510.54690.95720.91570.8491
0.16260.95750.48540.79220.9340
0.11900.96490.80030.95950.6787
>>B2=[c';b';e';f';g']'
B2=
0.81470.27600.15760.14190.6557
0.90580.67970.97060.42180.0357
0.12700.65510.95720.91570.8491
0.91340.16260.48540.79220.9340
0.63240.11900.80030.95950.6787
>>B3=[c';d';b';f';g']'
B3=
0.81470.09750.27600.14190.6557
0.90580.27850.67970.42180.0357
0.12700.54690.65510.91570.8491
0.91340.95750.16260.79220.9340
0.63240.96490.11900.95950.6787
>>B4=[c';d';e';b';g']'
B4=
0.81470.09750.15760.27600.6557
0.90580.27850.97060.67970.0357
0.12700.54690.95720.65510.8491
0.91340.95750.48540.16260.9340
0.63240.96490.80030.11900.6787
>>B5=[c';d';e';f';b']'
B5=
0.81470.09750.15760.14190.2760
0.90580.27850.97060.42180.6797
0.12700.54690.95720.91570.6551
0.91340.95750.48540.79220.1626
0.63240.96490.80030.95950.1190
>>x1=det(B1)/det(A)
x1=
-0.9850
>>x2=det(B2)/det(A)
x2=
2.4396
>>x3=det(B3)/det(A)
x3=
3.3124
>>x4=det(B4)/det(A)
x4=
-5.6515
>>x5=det(B5)/det(A)
x5=
1.7085
计算A的行列式
>>det(A)
ans=
-0.0250
计算B的行列式
>>det(B)
ans=
0.0647
求A的逆
>>inv(A)
ans=
3.1375-0.8078-1.8788-4.21945.1680
-8.60763.53142.890713.7204-14.3665
-6.28243.72203.613210.0084-12.4190
13.6173-6.8822-6.3938-23.528827.5825
-2.52921.07292.41935.8870-7.2671
求B的逆
>>inv(B)
ans=
-0.44303.49971.3255-2.6005-0.4697
1.4047-1.16260.2422-0.4475-0.0119
0.7210-1.8189-2.06352.44340.0765
-0.6122-0.18372.01650.0375-1.2564
0.0384-0.5157-0.73700.52671.7407
求A的秩
>>rank(A)
ans=
5
求B的秩
>>rank(B)
ans=
5
求A*B的行列式
>>det(A*B)
ans=
-0.0016
求A*B的逆
>>inv(A*B)
ans=
-74.064935.043331.2288121.5740-137.3442
6.8291-1.2718-2.2922-8.99518.6972
63.9620-31.4202-29.5061-105.6918122.3246
-9.31965.74524.625911.9660-15.4028
11.9582-6.3521-3.3817-16.757418.6360
>>rank(A*B)
ans=
5
>>det(A)*det(B)
ans=
-0.0016
验证
(1)
>>(A*B)'
ans=
0.95691.55661.62372.27322.2552
0.69220.94010.49690.93710.8090
0.94611.64921.68752.35632.3800
0.75071.58871.88401.94212.1481
1.13991.52122.21492.45452.4497
>>B'*A'
ans=
0.95691.55661.62372.27322.2552
0.69220.94010.49690.93710.8090
0.94611.64921.68752.35632.3800
0.75071.58871.88401.94212.1481
1.13991.52122.21492.45452.4497
(2)
>>inv(B)*inv(A)
ans=
-74.064935.043331.2288121.5740-137.3442
6.8291-1.2718-2.2922-8.99518.6972
63.9620-31.4202-29.5061-105.6918122.3246
-9.31965.74524.625911.9660-15.4028
11.9582-6.3521-3.3817-16.757418.6360
(3)
>>A*B
ans=
0.95690.69220.94610.75071.1399
1.55660.94011.64921.58871.5212
1.62370.49691.68751.88402.2149
2.27320.93712.35631.94212.4545
2.25520.80902.38002.14812.4497
>>B*A
ans=
2.07191.61352.19781.97691.9635
1.35281.25661.35491.48501.7372
1.71861.64541.52291.68941.6900
1.87142.04232.01132.29322.4625
0.87970.96970.84890.96900.8317
求矩阵X使得AXB=C
首先随机生成五阶方阵C
>>C=rand(5)
C=
0.49840.75130.95930.84070.3500
0.95970.25510.54720.25430.1966
0.34040.50600.13860.81430.2511
0.58530.69910.14930.24350.6160
0.22380.89090.25750.92930.4733
X=A的逆*B的逆
>>X=inv(A)*C*inv(B)
X=
3.8432-13.88582.14189.4404-4.5871
-9.331241.9602-7.9101-28.468314.8942
-7.873835.1218-5.4107-22.886110.1581
16.7545-75.607914.678449.3951-24.7450
-3.556817.0848-2.9018-11.26705.4559
实验二
1.验证:
对于一般的方阵A,B,C,D,
首先随机生成方阵A,B,C,D
A=rand(5)
A=
0.82580.10670.86870.43140.1361
0.53830.96190.08440.91060.8693
0.99610.00460.39980.18180.5797
0.07820.77490.25990.26380.5499
0.44270.81730.80010.14550.1450
>>B=rand(5)
B=
0.85300.07600.41730.48930.7803
0.62210.23990.04970.33770.3897
0.35100.12330.90270.90010.2417
0.51320.18390.94480.36920.4039
0.40180.24000.49090.11120.0965
>>C=rand(5)
C=
0.13200.23480.16900.54700.1835
0.94210.35320.64910.29630.3685
0.95610.82120.73170.74470.6256
0.57520.01540.64770.18900.7802
0.05980.04300.45090.68680.0811
>>D=rand(5)
D=
0.92940.30630.64430.93900.2077
0.77570.50850.37860.87590.3012
0.48680.51080.81160.55020.4709
0.43590.81760.53280.62250.2305
0.44680.79480.35070.58700.8443
>>Z=[A,B;C,D]
Z=
0.82580.10670.86870.43140.1361
0.85300.07600.41730.48930.7803
0.53830.96190.08440.91060.8693
0.62210.23990.04970.33770.3897
0.99610.00460.39980.18180.5797
0.35100.12330.90270.90010.2417
0.07820.77490.25990.26380.5499
0.51320.18390.94480.36920.4039
0.44270.81730.80010.14550.14500.40180.24000.49090.11120.0965
0.13200.23480.16900.54700.18350.92940.30630.64430.93900.2077
0.94210.35320.64910.29630.36850.77570.50850.37860.87590.3012
0.95610.82120.73170.74470.62560.48680.51080.81160.55020.4709
0.57520.01540.64770.18900.78020.43590.81760.53280.62250.2305
0.05980.04300.45090.68680.08110.44680.79480.35070.58700.8443
求Z的行列式
>>det(Z)
ans=
-0.0295
求det(A)*det(D)-det(B)*det(C)
>>det(A)*det(D)-det(B)*det(C)
ans=
1.8656e-004
随机生成对角矩阵A
>>A=diag([randrandrandrandrand])
A=
0.19480000
00.2259000
000.170700
0000.22770
00000.4357
随机生成对角矩阵B
>>B=diag([randrandrandrandrand])
B=
0.31110000
00.9234000
000.430200
0000.18480
00000.9049
随机生成对角矩阵C
>>C=diag([randrandrandrandrand])
C=
0.97970000
00.4389000
000.111100
0000.25810
00000.4087
随机生成对角矩阵D
>>D=diag([randrandrandrandrand])
D=
0.59490000
00.2622000
000.602800
0000.71120
00000.2217
>>Z=[A,B;C,D]
Z=
0.194800000.31110000
00.2259000
00.9234000
000.170700000.430200
0000.22770
0000.18480
00000.435700000.9049
0.979700000.59490000
00.438900000.2622000
000.111100000.602800
0000.258100000.71120
00000.408700000.2217
计算Z的行列式
>>det(Z)
ans=
-1.1243e-004
计算det(A)*det(D)-det(B)*det(C)
>>det(A)*det(D)-det(B)*det(C)
ans=
-9.3107e-005
计算A*D-B*C的行列式
>>det(A*D-B*C)
ans=
-1.1243e-004
实验三
求A列向量组的一个最大无关组,并把不属于
极大无关组的向量利用极大无关组表示.
N=200865083;
a=83;
b=86;
c=50;
d=88;
e=28;
f=63;
g=83;
h=60;
>>A=[a,b,c,d,3,4;1,2,3,4,4,3;12,15,22,17,5,7;e,f,g,h,8,0];
>>B=rref(A)
B=
1.0000000-0.35480.4656
01.000000-1.4905-2.0020
001.000000.04730.3950
0001.00001.79841.3383
所以a1,a2,a3,a4是一个极大无关组。
a5=-0,3548a1-1.4905a2+0.0473a3+1.7984a4;
a6=0.4656a1-2.0020a2+0.3950a3+1.3383a4.
实验四
>>a=83;
>>b=86;
>>c=50;
>>d=88;
>>e=28;
>>f=63;
>>g=83;
>>h=60;
>>b1=[1,1.9,f,c];
b2=[1,1.8,f,c];
A1=[a,b,c,d;0.5,1,1.5,2;12,15,22,17;e,f,g,h];
A2=[a,b,c,d;0.3,0.6,0.9,1.2;12,15,22,17;e,f,g,h];
A3=[a,b,c,d;0.1,0.2,0.3,0.4;12,15,22,17;e,f,g,h];
A4=[a,b,c,d;0.05,0.1,0.15,0.2;12,15,22,17;e,f,g,h];
>>x1=A1/b1
x1=
1.2043
0.0304
0.3517
1.2940
>>x2=A2/b1
x2=
1.2043
0.0182
0.3517
1.2940
>>x3=A3/b1
x3=
1.2043
0.0061
0.3517
1.2940
>>x4=A4/b1
x4=
1.2043
0.0030
0.3517
1.2940
>>x5=A2/b1
x5=
1.2043
0.0182
0.3517
1.2940
>>x6=A2/b2
x6=
1.2031
0.0182
0.3514
1.2931
>>x5=A1/b2
x5=
1.2031
0.0304
0.3514
1.2931
>>x6=A2/b2
x6=
1.2031
0.0182
0.3514
1.2931
>>x7=A3/b2
x7=
1.2031
0.0061
0.3514
1.2931
>>x8=A4/b2
x8=
1.2031
0.0030
0.3514
1.2931
实验五
随机生成4个5维向量,并进行正交化
随机生成4个5维向量
a=rand(4,5);
>>a
a=
0.11740.50790.02920.57850.5468
0.29670.08550.92890.23730.5211
0.31880.26250.73030.45880.2316
0.42420.80100.48860.96310.4889
正交化
>>b=null(a)
b=
0.6777
-0.5941
-0.3009
0.2892
0.1163
实验六
随机生成5阶矩阵,求其特征值及对应特征向量
eig(A)
ans=
3.2037
0.5684
-0.1026+0.5388i
-0.1026-0.5388i
-0.0457
>>[d,v]=eig(A)
d=
0.2283-0.53540.0179+0.1710i0.0179-0.1710i-0.1383
0.32430.14990.70770.70770.4629
0.51410.7181-0
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 大连理工大学 线性代数 实验 上机 报告
![提示](https://static.bdocx.com/images/bang_tan.gif)