第一題
E=eye(3);
R=rand(3,2);
O=zeros(2,3);
S=diag([2,3]);
A=[E,R;O,S];
A^2
B=[E,(R+R*S);O,S^2]
第二題
H=hilb(5)
P=pascal(5)
Hh=det(H)
Hp=det(P)
Th=cond(H)
Tp=cond(P)
%第三題:
A=fix(10*rand(5))
H=det(A)
Trace=trace(A)
Rank=rank(A)
Norm=norm(A)
%第四題:
A=[-29,6,18;20,5,12;-8,8,5]
[V,D]=eig(A)
%數(shù)學(xué)意義略
%第五題方法一:
%(1):
A=[1/2,1/3,1/4;1/3,1/4,1/5;1/4,1/5,1/6];
b=[0.95,0.67,0.52]';
x=inv(A)*b
(2):
B=[0.95,0.67,0.53]';
x=inv(A)*B
%(3):
cond(A)
%第五題方法二:
A=hilb(4)
A(:,1)=[]
A(4,:)=[]
B=[0.95,0.67,0.52]';
X=inv(A)*B
B1=[0.95,0.67,0.53]';
X1=inv(A)*B1
N=cond(B)
N1=cond(B1)
Na=cond(A) %矩陣A為病態(tài)矩陣
%第六題
A=[1,4,9;16,25,36;49,64,81]
B=sqrtm(A)
C=sqrt(A) %sqrtm函數(shù)是以矩陣為單位進行計算,sqrt函數(shù)是以矩陣中的元素進行計算