Table of contents
one,
There is a block matrix, where E, R, O and S are the identity matrix, random matrix, zero moment matrix and pair respectively Angular matrix, try to verify it through numerical calculation
.
---------------------------- ------------------Examples--- ----------------------------------------- -----------------
E=eye(3,3);
R=rand(3,3);
O=zeros(3,3);
S=diag([1,2,3]);
A=[E,R;O,S];
if(A^2==[E,R+R*S;O,S^2])
fprintf('已验证\n\n\n');
else
fprintf('未得到验证\n');
end
------------------------------------------ Run result--------------------------- ---------------------------------
2,
Create a 5×5 matrix and find its determinant value, trace, rank and norm.
---------------------------- -------------------Example example-- ---------------------------------------- --------------------
H=hilb(5);
P=pascal(5);
Hh=det(H);
Hp=det(P);
Th=cond(H);
Tp=cond(P);
if(abs(Th-1)<abs(Tp-1))
fprintf('希尔伯特矩阵性能好\n');
else
fprintf('帕斯卡矩阵性能好\n');
end
------------------------------------------ Run result--------------------------- ----------------------------
three,
Generate a fifth-order Hilbert matrix H and a fifth-order Pascal matrix P, and find the values of their determinants Hh and Hp and their condition numbers Th and Tp to determine which matrix has better performance and why?
---------------------------- ------------------Examples--- ----------------------------------------- -----------------
fprintf('\n5x5矩阵\n');
J=rand(5,5)*10
fprintf('\n行列式\n');
J_v=det(J) %
fprintf('\n迹\n');
J_t=trace(J) %
fprintf('\n秩\n');
J_z=rank(J)%
fprintf('\n范数\n');
J_n=norm(J)%
------------------------------------------ Run result--------------------------- ----------------------------
Four,
It is known, Find the eigenvalues and eigenvectors ofA, and analyze its mathematical meaning.
---------------------------- --------------------Examples- ---------------------------- ---------
fprintf('\nA\n');
A=[-29 6 18;20 5 12;-8 8 5]
[V,D]=eig(A);
fprintf('\n特征值%d\n',D(1,1));
fprintf('\n特征向量[%d %d %d]\n\n',V(:,1));
fprintf('\n特征值%d\n',D(2,2));
fprintf('\n特征向量[%d %d %d]\n\n',V(:,2));
fprintf('\n特征值%d\n',D(3,3));
fprintf('\n特征向量[%d %d %d]\n\n',V(:,3));
fprintf('\n\n');
------------------------------------------ Run result--------------------------- ----------------------------
five,
The following is a linear system of ill-posed equations:
(1) Use matrix inversion method to find the solution of the equation.
(2) Change the vector element b on the right side of the equation to 0.53, solve it again, and compare the changes in b3 with the relative changes in the solution.
(3) Calculate the condition number of coefficient matrix A and analyze the conclusion.
---------------------------- -------------------Example example-- ----------------------------------------- --------
A=[2 3 4;3 4 5; 4 5 6];
fprintf('\n系数矩阵A\n');
A=1./A
fprintf('\nb\n');
b=[0.95; 0.67;0.52]
%(1)
fprintf('\n(1)的解:\n');
X=A^-1*b
%(2)
fprintf('\n(2)的解:\n');
b(3)=0.53;
X2=A^-1*b
%(3)
fprintf('\nA的条件数:\n');
tjs=cond(A)
%% 6
fprintf('\nA:\n');
A=rand(3,3)*10
fprintf('\nsqrtm(A):\n');
sqrtm(A)
fprintf('\nsqrt(A):\n');
sqrt(A)
------------------------------------------ - Running result---------------------------------------- --------------------------------
If there is any infringement, please contact me immediately!