How to create positive semidefinite matrix from random value ?

29 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Walter Roberson
Walter Roberson il 8 Gen 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

Più risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by