0

Matlab判断矩阵的正定性

 6 months ago
source link: https://charon-cheung.github.io/2022/07/20/Matlab/Matlab%E5%88%A4%E6%96%AD%E7%9F%A9%E9%98%B5%E7%9A%84%E6%AD%A3%E5%AE%9A%E6%80%A7/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Matlab判断矩阵的正定性 | 沉默杀手

Matlab判断矩阵的正定性
2022-07-20|Matlab|
Word count: 114|Reading time: 1 min

Matlab判断矩阵的正定性,实际是判断特征值是否全为正

% 判断矩阵m是正定、半正定还是负定
m = [2 -1; -1 2];

if issymmetric(m) % 检查矩阵是否对称
% disp('矩阵对称');
d = eig(m); % 计算矩阵特征值
if all(d > 0)
disp('矩阵正定');
elseif all(d >= 0)
disp('矩阵半正定');
else
disp('矩阵负定');
end
else
disp('矩阵不对称');
end
©2018 - 2022 By Charon Cheung
Driven - Hexo|Theme - Melody

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK