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 Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by