-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomework_ch3.m
More file actions
55 lines (44 loc) · 1.37 KB
/
Homework_ch3.m
File metadata and controls
55 lines (44 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
%5.3日作业
%------------------------------分界符----------------------------------%
%Q1
format short %将显示格式改为小数;若显示分数使用rat
disp('the answer for Q1')
A_1=rand(5,6)*(200-100)+100
%------------------------------分界符----------------------------------%
%Q2
x_2=1+randn(5,10)*sqrt(0.2)
%------------------------------分界符----------------------------------%
%Q3
A_3=rand(4,4);
B=diag(diag(A_3),0)
%------------------------------分界符----------------------------------%
%Q4
A_4=rand(4,4);
disp('A的逆矩阵为');A_4^(-1)
disp('A对应的行列式的值为');det(A_4)
%------------------------------分界符----------------------------------%
%Q5
A_5=[1,4,7,10;2,5,8,11;3,6,9,12];
B_5=rot90(A_5,1)
C_5=rot90(A_5,-1)
%------------------------------分界符----------------------------------%
%Q6
H=hilb(5);P=pascal(5);
det(H)
det(P)
CN_H=cond(H)
CN_P=cond(P)
%此处可以有一个判断程序
%------------------------------分界符----------------------------------%
%Q7
A_7=[-29,6,18;20,5,12;-8,8,5];
[V,D]=eig(A_7)%这个V,D的含义没有理解
%------------------------------分界符----------------------------------%
%Q8
A_8=[1/2,1/3,1/4;1/3,1/4,1/5;1/4,1/5,1/6];
b_8=[0.95;0.67;0.52]
disp('方程的解为')
x_8=A_8^(-1)*b_8
b_8(3,1)=0.53
x_8_2=A_8^(-1)*b_8
CN_A=cond(A_8)