Filter löschen
Filter löschen

How to create positive semidefinite matrix from random value ?

36 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 8 Jan. 2021
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

Weitere Antworten (0)

Kategorien

Mehr zu Particle & Nuclear Physics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by