How to identify a matrix is Positive Definite

posted Sep 28, 2015, 10:04 AM by Javad Taghia
Matlab Code: http://www.mathworks.com/matlabcentral/answers/101132#answer_140036

A = [1,0;0,2]; % Example matrix
eig_A = eig(A);
flag = 0;
for i = 1:rank(A)
if eig_A(i) <= 0 
flag = 1;
end
end
if flag == 1
disp('the matrix is not positive definite')
else
disp('the matrix is positive definite')
end
Comments