How to create positive semidefinite matrix from random value ?

조회 수: 29 (최근 30일)
Waqar Ahmed
Waqar Ahmed 2021년 1월 8일
답변: Walter Roberson 2021년 1월 8일
I form a matrix A in matlab as
A=rand(50);
I want to know how to make symmetric matrix using equation
A=0.5 *(A+A');
but how can I make it positive semidefinite matrix?

채택된 답변

Walter Roberson
Walter Roberson 2021년 1월 8일
A = rand(50);
A = 0.5 *(A+A');
issymmetric(A)
ans = logical
1
d = eig(A)
d = 50×1
-2.6403 -2.3499 -2.3084 -2.1472 -2.0568 -1.9520 -1.8574 -1.5880 -1.5540 -1.4120
all(imag(d) == 0 & d >= 0)
ans = logical
0
APos = A'*A;
issymmetric(APos)
ans = logical
1
d = eig(APos)
d = 50×1
0.0000 0.0048 0.0360 0.0436 0.0506 0.0978 0.1031 0.1715 0.1725 0.1929
all(imag(d) == 0 & d >= 0)
ans = logical
1

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by